Methods and systems for automatically identifying detection parameters for an implantable medical device

ABSTRACT

An initial set of parameters for operating one or more detection tools is automatically derived and subsequently adjusted so that each detection tool is more or less sensitive to signal characteristics in a region of interest. Detection tool(s) may be applied to physiological signals sensed from a patient (such as EEG signals) and may be configured to run in an implanted medical device that is programmable with the parameters to look for rhythmic activity, spiking, and power changes in the sensed signals, etc. A detection tool may be selected and parameter values derived in a logical sequence and/or in pairs based on a graphical representation of an activity type which may be selected by a user, for example, by clicking and dragging on the graphic via a GUI. Displayed simulations allow a user to assess what will be detected with a derived parameter set and then to adjust the sensitivity of the set or start over as desired.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is related to U.S. patent application Ser. No.13/802,457, filed Mar. 13, 2013, entitled “Methods and Systems forAutomatically Identifying Detection Parameters for an ImplantableMedical Device” by Sun, et al., which claims priority to and benefit ofU.S. Provisional Patent Application No. 61/730,498 filed Nov. 27, 2012,entitled “Methods and Systems for Automatically Identifying DetectionParameters for an Implantable Medical Device” by Sun, et al., andassigned to the assignee of the present application. Each of U.S. patentapplication Ser. No. 13/802,457 and Provisional Application No.61/730,498 is hereby incorporated herein, in its entirety, by reference.

FIELD OF THE INVENTION

The present technology relates generally to methods and systems foridentifying the parameters that will determine what an activeimplantable medical device detects relative to physiological data beingmonitored by the implantable medical device, especially identifyingdetection parameters relative to electrographic activity.

BACKGROUND

Systems and methods that include algorithms for identifying whenphysiological data sensed from a patient exhibit certain features orcorrespond to certain physiological states are desirable in diagnosing,monitoring and treating patients. Specifying the parameters necessaryfor the algorithms to operate as expected and to generate the desiredoutcome is generally not an intuitive process for the patient'sphysician. It would be beneficial to make these systems and methodseasier for a physician to use with regard to a particular patient or setof patients.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1A is a schematic illustration of a set of adjustable detectionparameters that, among others, may be associated with a half wavedetector.

FIG. 1B is a graph of a time-series representation of an electrographicsignal exhibiting a plurality of transitions in the direction of thesignal.

FIG. 2 is the graph of FIG. 1B in which two half waves are identified.

FIG. 3 is the graph of FIG. 1B in which a set of eleven half waves areidentified.

FIG. 4 is the graph of FIG. 3 in which parameters of a method foridentifying a minimum frequency are illustrated.

FIG. 5 is a graph of a time-series representation of an electrographicsignal exhibiting a plurality of regions, including a region ofinterest, a region of seizure activity, and a region of baselineactivity.

FIG. 6 is a representation of a display according to some embodimentscorresponding to a simulation in which a half wave detector is run onselected electrocorticographic (ECOG) data.

FIG. 7 is a representation of the display of FIG. 6 after a newsimulation has been run and the display refreshed with the results ofthe new simulation.

FIG. 8A is a flow diagram of a method of automatically deriving and,optionally, subsequently adjusting, parameter sets for detection toolsfor different activity types in a user-selected region or regions ofinterest, according to embodiments.

FIG. 8B is a flow diagram of a method of automatically deriving and,optionally, subsequently adjusting, a parameter set for looking forrhythmic activity in an electrocorticographic signal using a detectiontool in the form of a half wave detector.

FIG. 8C is a flow diagram of a method of automatically deriving and,optionally, subsequently adjusting, a parameter set for looking forspiking activity in an electrocorticographic signal using a detectiontool in the form of a half wave detector.

FIG. 9A is a power spectrum corresponding to the frequency content in aregion of interest in an electrographic signal according to embodimentsusing fast Fourier transform averaging.

FIG. 9B is a power spectrum corresponding to the frequency content in aregion of interest in an electrographic signal according to embodimentsusing linear predictive coding.

FIG. 10A is a plot comparing the frequency content of a region ofinterest in an electrographic signal to the frequency content of tworegions of baseline activity according to embodiments.

FIG. 10B is a plot representing a ratio of the frequency content of aregion of interest to the frequency content of one or more regions ofbaseline activity according to embodiments, revealing a salientfrequency at about 10 Hz.

FIG. 11A is a graphical representation of a distribution of data,specifically, a histogram showing the distribution of pairs of possiblevalues of two parameters for a half wave detector related to defining aminimum frequency the half wave detector will detect organized by uniquefrequencies (on the x-axis), according to embodiments.

FIG. 11B is a graphical representation of a distribution of data,specifically, a histogram showing the distribution of pairs of possiblevalues of two parameters for a half wave detector related to defining aminimum frequency the half wave detector will detect organized byinteger frequencies (on the x-axis), according to embodiments.

FIG. 11C is a graphical representation of a distribution of data,specifically, a histogram showing the distribution of pairs of possiblevalues of two parameters for a half wave detector related to defining aminimum frequency the half wave detector will detect organized so thatthe number of pairs in each bin (for a given frequency on the x-axis)will be approximately the same, according to embodiments.

FIG. 12A, FIG. 12B, FIG. 12C, FIG. 12D, and FIG. 12E each is a graphicalrepresentation of spiking activity as it may occur in a representationof an electrographic signal as sensed from a patient.

FIG. 13 is a graphical representation of method for selecting a valuefor a hysteresis parameter for a half wave detector configured to lookfor rhythmic activity according to embodiments.

FIG. 14 is a graphical representation of a method for selecting a valuefor a minimum half wave amplitude parameter for a half wave detectorconfigured to look for rhythmic activity according to embodiments.

FIG. 15A, FIG. 15B, FIG. 15C, and FIG. 15D are graphicalrepresentations, namely, a time-series representation of anelectrographic signal and a spectrogram of the same signal, of each oftwo dissimilar regions of interest associated with a similar condition(e.g., onset of seizure activity).

FIG. 16A, FIG. 16B, FIG. 16C, and FIG. 16D are graphicalrepresentations, namely, time-series representations, of anelectrographic signal and a spectrogram of the same signal, of each oftwo similar regions of interest associated with a similar condition(e.g., onset of seizure activity).

FIG. 17A is a graphical representation of the frequency response (powerspectrum) for a first region of interest associated with a first onsetperiod of a seizure.

FIG. 17B is a graphical representation of the frequency response (powerspectrum) for a first region of interest associated with a second onsetperiod of a seizure.

FIG. 17C is a graphical representation of a frequency response (powerspectrum) for a combination according to embodiments of the first onsetperiod of FIG. 17A and the second onset period of FIG. 17B.

FIG. 18 is a graphical representation of method for selecting a valuefor a hysteresis parameter for a half wave detector configured to lookfor spiking according to embodiments.

FIG. 19 is a graphical representation of a method for selecting a valuefor a minimum half wave amplitude parameter for a half wave detectorconfigured to look for spiking according to embodiments.

FIG. 20A, FIG. 20B, and FIG. 20C each is a graphical representation of arhythmic type of activity as may occur in electrographic signals sensedfrom a patient.

FIG. 21A, FIG. 21B, and FIG. 21C each is a graphical representation of aspiking type of activity as may occur in electrographic signals sensedfrom a patient.

FIG. 22A, FIG. 22B, and FIG. 22C each is a graphical representation of acombination of a rhythmic type of activity and a spiking type ofactivity as may occur in electrographic signals sensed from a patient.

FIG. 23A, FIG. 23B, FIG. 23C, FIG. 23D and FIG. 23E each is a screenshot of a graphical user interface as may be used according toembodiments.

FIG. 24 is a schematic illustration of a set of adjustable detectionparameters that may be, among others, associated with a line lengthdetector.

FIG. 25 is a flow chart of a method deriving a detection toolimplemented in an active implantable device implantable in a patient.

FIG. 26 is graph of a time-series representation of an electrographicsignal exhibiting a plurality of regions, including a fixed region ofinterest, a region of seizure activity, and a region of baselineactivity.

FIG. 27 is graph of a time-series representation of an electrographicsignal exhibiting a plurality of regions, including a user definedregion of interest, a region of seizure activity, and a region ofbaseline activity.

FIG. 28 is a flow chart of a method selecting a detector type.

FIG. 29 is a graph of a power spectrum of a region of interest.

FIG. 30 is a graph of a frequency spectrum of a region of interest.

FIG. 31A and FIG. 31B form a flow chart of a pattern characterizationapproach for selecting a detector type.

FIG. 32 is a flow chart of a performance comparison approach forselecting a detector type.

FIG. 33 is a flow chart of a method of comparing detector type metricsagainst various criteria to select a best detector type.

FIG. 34 is a graph of accuracy detection as a function of a half-waveamplitude parameter of a detector type.

The drawings referred to in this description should not be understood asbeing drawn to scale unless specifically noted.

DETAILED DESCRIPTION

Implantable medical systems are under investigation that use sensors tomonitor electrographic signals obtained from a patient and then recordportions of the monitored signals (or some type of digitalrepresentation thereof) whenever the signals exhibit certaincharacteristics (e.g., when certain conditions are satisfied and/or whencertain thresholds are exceeded or not met). One implantable componentof these medical systems may be configured to determine when the certaincharacteristics are exhibited in the monitored signals. An implantablecomponent also may be configured to determine whether and when themonitored signals correspond to a particular physiological state basedon a condition of the implantable medical device itself (e.g., when anamplifier or amplifiers go into saturation or how often an amplifier oramplifiers go into saturation). Conditions of the implantable medicaldevice itself, as distinguished from the physiological signals theimplantable medical device may be configurable to monitor, are oftenreferred to as “diagnostics” or “device diagnostics”. Sometimes, one ormore device diagnostics may be used as a proxy for a physiological stateof the patient. For example, when certain amplifiers in the implantedmedical device are saturated and remain saturated for a predeterminedperiod of time, the patient may be deemed to be experiencing anelectrographic event (e.g., seizure).

Generally, an implantable component of an implantable medical devicesystem that is configurable to process signals and to run one or morealgorithms on data may be referred to herein as an “active implantablemedical device” to distinguish it, for example, from a passiveimplantable component such as a catheter.

One or more algorithms implemented in whole or in part by theimplantable component may be relied upon to decide when thecharacteristics are exhibited in the monitored signals or when one ormore of the device diagnostics should be detected as a condition thatshould be recorded or otherwise noted or acted upon. Each algorithm mayoperate on one or more channels of data acquired from the patient or onone or more of the diagnostics. An algorithm may be referred to as a“detection tool”, a “detector”, or an “event detector”.

For data acquired from the patient, a given set of sensing channels ofthe implant and associated algorithms executable by the implant maydefine a “detection channel.” A given detection channel may beassociated with one or more event detectors. Different event detectorsmay be configured for a given patient to use signals that arise fromdifferent areas of the patient's brain or signals that are separated bytime (e.g., one signal type followed by the same or a different signaltype).

When an algorithm is intended to be implemented primarily by animplantable component using an implanted power supply (e.g., a primarycell battery or a rechargeable battery), it will be appreciated that thepower allocated for running the algorithm is an important designconsideration. Accordingly, algorithms are often developed and/orselected based on the amount of power that is likely to be consumed inrunning them as well as other considerations (e.g., how frequently analgorithm is likely to be run).

NeuroPace, Inc. has developed a responsive neurostimulation systemmanufactured under the trademark “RNS SYSTEM” which includes animplantable component comprising a neurostimulator. (As may beappreciated by the implantable component's name, the RNS SYSTEMneurostimulator is capable of delivering electrical current stimulationto the patient, but this particular neurostimulator is also capable ofprocessing signals received from the patient and device diagnosticswhich data then may be used by the implant to determine whether one ofseveral actions should be taken, e.g., recording or storing data ordelivering stimulation).

The RNS SYSTEM neurostimulator may be implanted in a hole cut out from apatient's cranial bone (sometimes referred to as a “defect” formed inthe cranium). Alternatively, the neurostimulator component of animplantable responsive neurostimulation system may be implantedelsewhere in the patient, such as between the cranium and the scalp orin the pectoral region. The neurostimulator may be connected via one ormore leads to a plurality of electrodes implanted in or on the patient'sbrain (e.g., the neurostimulator can be connected to one or two leads,and each lead may have four electrodes on a distal end thereof).

The neurostimulator is configurable to sense electrographic signalsobtained from the patient at a predetermined sampling rate and toreceive the signals on one or more channels. The neurostimulator orother component of the neurostimulation system may filter or otherwisecondition (e.g., amplify and/or digitize) the signals. The signalsreceived on each channel may be operated on by one or more algorithms,tools or detectors to identify characteristics in the data (e.g.,characteristics that are believed to correspond to the electrographiconset of an epileptic seizure). Because in the RNS SYSTEMneurostimulator (and other neurostimulators) the power source for theneurostimulator is a battery contained in the implant (e.g., a primarycell battery or a rechargeable battery), the algorithms, or tools ordetectors the neurostimulator uses to operate on the data desirably areselected to consume as little power as possible to achieve theirobjectives and therefore may be categorized generally as lowcomputational complexity or “LCC” algorithms.

In the RNS SYSTEM, the algorithms or tools include a half wave detector,a line length detector and an area detector. The half wave detectorgenerally may be characterized as a waveform morphology analysis tooland the line length and area detectors generally may be characterized as“signal change” detectors.

An objective of a half wave detector may be to generate an outputwhenever the power of a portion of a signal falls within a particularfrequency range. The particulars of how a half wave detector may beconfigured to operate in the context of a responsive neurostimulationsystem (or other diagnostic implantable medical device system) aredescribed in more detail below with reference to example(s). Here it isnoted generally that, even though a half wave detector can be concernedwith the frequency content of a signal, the tool operates in the timedomain rather than in the frequency domain. For at least this reason,the half wave detector is considered to be an LCC algorithm relative toone that involves transformations into the frequency domain, such asfast Fourier transforms (or FFTs).

An objective of the line length detector may be to generate an outputthat corresponds to how much the frequency and/or amplitude of a portionof a signal within a particular time window is varying relative to, forexample, a long term line length trend for that signal. The line lengthdetector is sometimes referred to as a simplification of the fractaldimension of a waveform. The result of the line length detector is meantto correspond to an approximation of the overall power of the signalrelative to a trend. For example, the line length detector is meant to“detect” when a portion of a signal in a given time window departs fromthe trend and exhibits a change in frequency or amplitude swings orboth; a change in amplitude or frequency suggests something different ishappening in the patient: for example, when the power increases, theline length detector may detect the onset of or a precursor to anelectrographic seizure.

An objective of the area detector is to generate an output thatcorresponds to how much the integral (or area under a curve) of a signalwithin a particular time window is varying relative to, for example, along term area trend for that signal. The area detector is sometimesreferred to as a representation of the energy of a waveform. As with theline length detector, the area detector is meant to identify conditionswhen the signal departs significantly from the long term trendsuggesting something undesirable or abnormal is occurring in thepatient.

Each of the line length detector and the area detector is considered tocomprise an LCC algorithm, since each requires little power to runrelative to other, more complex algorithms that would provide a measureof how much a waveform is varying in terms of amplitude or energy.

Even though the half wave detector, the line length detector and thearea detector are each deemed to be algorithms of relatively lowcomplexity, there nonetheless may be a significant number and kind ofparameters that need to be specified in order for the running of eachalgorithm to have an optimal result.

A given system may be configured so that all or some of the parametersthat control how an algorithm will operate (e.g., what sensedphysiological data the algorithm will ‘detect’) are programmable by auser. In most circumstances, the “user” will be a physician diagnosingor otherwise treating the patient in whom the active implantable medicaldevice is implanted. A system further may be configured so that one ormore of the programmable parameters are set to “default” or otherinitial values at the time the system is manufactured or at the time thesystem is initially set up for a patient (e.g., in the operating room orduring an initial post-op visit with a clinician).

The number and kind of parameters for a given tool may be relativelyeasy to understand and specify for an engineer or practicing scientistor for someone who otherwise is interested in how the algorithms operateat a detailed level. However, the typical user (e.g., a busy neurologistor a neurosurgeon with many patients) who is tasked with programming (orreprogramming, as the case may be) the tools may not have the time orinclination to develop a comprehensive understanding of what the variousparameters are and how each relates to the condition or state of thepatient the user wants the implant to monitor and/or treat. These usersmay be better served by system that allows a user to select what todetect graphically (e.g., on a display of a user interface with theimplant and/or a database) and then automatically derives the parametersfor the various tools based on what the user has selected.

The complexity of selecting parameters and parameter values for a toolmay be illustrated with reference to the half wave tool (or half wavedetector). A half wave tool may require a minimum of seven parameters tobe specified, and may be associated with still other parameters thatought to be specified for optimum performance or which may be optionaland best indicated for some circumstances and not others. In an exampleof a half wave detector discussed in detail here there are at leastseven parameters that may be specified: (1) half wave hysteresis; (2)minimum half wave amplitude; (3) minimum half wave width; (4) half wavecount criterion; (5) half wave window size; (6) qualified analysiswindow count; and (7) detection analysis window size. Each of theseseven parameters may be associated with 1 to over 1000 discrete values.

It will be appreciated that, rather than learning what the “qualifiedanalysis window count” parameter signifies and how to choose anappropriate value for it, a user may find it far easier to perceive afeature or pattern in a waveform in the graphical content of a signalsensed from a patient and then select it as something the user wants atool to look for. A system with such a “graphical detection” featurewould allow a user to configure the system to detect something (e.g., apattern occurring in an electrographic signal) without needing to have acomprehensive understanding of how each parameter and associatedparameter value will effect the operation or outcome of a givendetection tool. For example, a user may be able to look at a display ofa recorded EEG signal and conclude that the graphical content of thesignal includes regions of highly rhythmic activity, and that he or shewants to configure one or more detection tools to detect that samepattern whenever it occurs in the patient. The user may want toaccomplish this without having to understand what the detectionparameters are and how each relates to the pattern the user wants todetect.

In some neurostimulation systems, the neurostimulator may be providedwith at least three detection tools or algorithms that are available toand configurable by a user, namely, a half wave detector, a line lengthdetector, and an area detector. Each of these algorithms is associatedwith a set of possible operating parameters.

The neurostimulator also can be configured to record signals sensed fromthe patient (or digital or other representations of the signals) and torecord device diagnostics (i.e., information about the condition of theneurostimulator at certain times (e.g., whether an amplifier oramplifiers go into or out of saturation upon receiving an input signalfrom the patient)). As noted above, one or a combination of devicediagnostics may serve as a proxy for something that is happening withthe patient (such as a seizure).

The neurostimulator can communicate wirelessly with one or more devicesexternal to the patient such as via telemetry. One of these externaldevices is in the control of the patient and may be referred to as a“patient remote monitor” or sometimes as a “patient initiating device.”Another of these external devices is in the control of the user (e.g., aphysician) and may be referred to as a “programmer.” A wand may benecessary to establish an inductive telemetry link between theneurostimulator, on the one hand, and either the patient remote monitoror the programmer, on the other hand. In other cases, a link between theimplanted component and one or more of the external components may beestablished by some other means that eliminates the requirement for awand, such as by long range telemetry or some other wireless method ofcommunication.

An external component such as a programmer may include a computer orcentral processing unit implemented in a wide variety of ways, such as alaptop computer, a tablet computer, a notebook computer, or asmartphone. Similarly, an external component that comprises a patentremote monitor may be implemented in the same way as a programmer(laptop, tablet, smartphone, etc.) or, since it may be required to havefar less functions than a programmer, something simpler with a smallerform factor, such as a wrist watch or key fob or handheld device.

Using the inductive telemetry or other communications link, both thepatient remote monitor and the programmer may be used to receive datathat has been stored by the neurostimulator (e.g., recorded portions ofelectrographic signals or device diagnostics reflecting informationabout a condition of the neurostimulator at the time an “event” wasdetected by an event detector). Once the data is on the patient remotemonitor or the programmer, it may be stored locally on these devices.Alternatively or additionally, data stored on the patient remote monitoror the programmer may be transferred elsewhere, such as to a centraldatabase.

A patient may have one-way access to such a central database, forexample, by selectively connecting the patient remote monitor to thecentral database via a secure communications link such as a broadbandconnection (or a telephone “dial up” link) to transfer data from theimplanted neurostimulator to the database. A user (e.g., a physician)may have bidirectional access to such a central database, for example,by selectively connecting the programmer to the central database toupload data from the neurostimulator (or from the neurostimulators of aphysician's other patients) and to download data from the centraldatabase that the user can then beneficially use locally on theprogrammer in some fashion. For example, changes to the software theneurostimulator uses may be communicated from the central database tothe programmers and then from the programmers to the implantedneurostimulators. In addition, a secure website may afford authorizedusers controlled access to parts of the central database or certaincategories of data in the database.

The programmer also may be used to receive data in real time from theneurostimulator (for so long as the inductive telemetry link isestablished) and to selectively store the data received in real time forlater review and other uses. In addition, and as the name of thecomponent implies, the programmer can be used to program theneurostimulator, including but not limited to programming whichparameters are used when a given algorithm is run and what values eachparameter used in an algorithm will have.

The user generally will decide what type or types of physiological data(e.g., electrographic activity) he or she wants the neurostimulator todetect by reviewing records of electrographic activity for the patient.For example, the user may review electrographic activity previouslyrecorded by the neurostimulator in order to select the nature and kindof activity that the user wishes the neurostimulator to detect in thefuture. Alternatively or additionally, the user may reviewelectrographic activity from the patient in real time to make decisionsabout what to detect. The user may also review electrographic activityrecorded from the same patient or from different patients (e.g., withsimilar demographics) that are accessible from the central database.

A programmer may have features that allow a user to specify, among otherthings, parameters and parameter values for a particular detection tool,and then run the algorithms on previously-acquired records ofelectrographic activity. These simulations are intended to give the userexamples of the nature and type of electrographic activity a given setof detection parameters and parameter values will detect.

In embodiments described here, systems and methods are provided withfeatures that allow a user to review, on a display associated with oneor more external components, physiological data acquired from a patient(either previously or in real time by one or more implantablecomponents), and to select one or more regions of interest in thephysiological data based on the graphical content on the region(s) ofinterest. These features collectively may be referred to herein asenabling “graphical detection.”

Using the selected region(s) of interest as an input, the systems andmethods are configured to automatically derive a set of parameters andvalues for the same that will be used by one or more detectionalgorithms. The intention is that, if the implantable component (e.g.,the neurostimulator in the case of an RNS SYSTEM) is programmed with theautomatically-derived parameter set, then when the relevant detectionalgorithm operates on physiological data acquired from the patient inthe future, the algorithm will detect activity of the same nature andtype as that which characterizes the user-specified region(s) ofinterest, if that nature and type of activity occurs while the algorithmis being run. The systems and methods therefore will assist the user inspecifying the detection tool and a set of operating parameters for agiven detection tool based on graphical content selected by the user.Thus the user will be relieved of some of the burden of having to firstunderstand and then choose the detection tool and the values for theparameters associated with the detection tool (e.g., a value for a“detection analysis window size” parameter or a “hysteresis parameter”in a half wave detection tool). Indeed, in some embodiments, the userneed not even characterize the type of activity that appears in theuser-selected region(s); rather, the systems and methods will determinean activity type or pattern automatically.

In some embodiments, one or more “baselines” may be used by the systemtogether with the region(s) of interest in automatically deriving theparameter values. These baselines may be selected automatically or bythe user or some combination of the two.

After a user has selected region(s) of interest and/or baseline(s), theuser can ask the system to automatically derive a set of parameters for,e.g., a detection tool, based on the selections. Then the user can run asimulation using, for example, the programmer or a website interfacewith a central database, in an effort to assess whether the detectiontool with the automatically-derived set of parameters is likely todetect the patterns or other features that characterize the region(s) ofinterest that the user wants the detection tool to detect.

There are many possible sources for the signals used in suchsimulations. For example, the user may be able to select signals thatwere previously recorded and stored on the user's programmer or in acentral database for the particular patient whose device the user iscurrently programming. These previously-recorded and stored signals mayhave been downloaded from the patient's active implantable medicaldevice or may have been acquired while the patient's physiologicalactivity was being monitored during some sort of diagnostic procedurebefore the implantable medical device was implanted (e.g., anin-hospital intracranial EEG monitoring procedure).

Alternatively, or additionally, a user may be able to access signals forrunning simulations from other patients the user is treating or fromother patients other users are treating who have something in commonwith the user's patient. For example, signals for simulations may bedrawn from a database of signals for patients with a common demographicas the user's patient, such as women having a particular neurologicalcondition and who are between 18 and 25 years of age. Similarly, and forexample in epilepsy, signals for simulations may be selected from a setof signals acquired from patients with the same seizure focus (e.g., aseizure focus in the temporal lobe, a seizure focus in a hippocampus).Signals used for simulations that are associated with other patients maybe retrievable from the user's programmer or from a central database.They may be anonymized or “de-identified” to protect patient privacy, orthe signals may be averaged for a given population or otherwise adjustedor filtered for use in simulations of the type contemplated herein.

In still other instances, a user may be able to run a simulation of adetection tool using an automatically-derived set of parameters onsignals being acquired in real time from the patient's activeimplantable medical device. For example, during a patient's visit to thedoctor's office, the doctor may establish a communications link betweenthe doctor's programmer and the patient's active implant, select aregion or region(s) of interest, ask the system to automatically derivea set of parameters for the relevant detection tool, and then run asimulation on the programmer of the detection tool with theautomatically-derived parameters on signals being acquired in real timefrom the patient's active implant to assess what patterns and featureslikely will be detected if the doctor reprograms the patient's activeimplant with the automatically-derived parameter set.

Based on the foregoing, it will be appreciated that a user can usesimulations to gauge whether a given automatically-derived parameter setis likely to result in detection of what the user wants the implantablecomponent to detect. If the user is not satisfied with the simulation,the user can reject the automatically-derived set and start over, forexample, by changing the region(s) of interest or by selecting adifferent region of interest or regions of interest and/or a differentbaseline or baselines. If the user is satisfied with the simulation,then the user can accept the automatically-derived set and subsequentlyprogram the implantable component with the set (e.g., use an RNS SYSTEMprogrammer to program the implanted neurostimulator with the set via thewand and an inductive telemetry link).

Alternatively, in some embodiments, when the user is less thancompletely satisfied with the results of a simulation (and thus with anautomatically-derived set of parameters), the user may be provided withthe option of adjusting one or more parameter values (for example todetect a particular pattern earlier or later (e.g. within the firstsecond of activity or after the first second) or to detect more or lessof a particular feature (e.g. detect higher amplitude signals or loweramplitude signals) and then instructing the system to generate anotherset reflecting the adjustment. For example, the system may allow theuser to adjust a “pattern duration” characteristic so that theautomatically-derived parameters will be biased toward detectingactivity that lasts longer than (or shorter than) the duration withwhich a region of interest is characterized. Similarly, the system mayallow the user to adjust a “signal amplitude” characteristic so that theautomatically-derived parameters will be biased towards detecting more(or less) activity that is characterized by the same type of activitywith which a region of interest is characterized but with a with loweror higher amplitude threshold. The sensitivity adjustments may beoffered to the user based on what the systems and methods infer that theuser is likely to see in the region of interest that the user wants thedetection tool to detect (e.g., rhythmic activity, spiking activity, achange in power of the signal, etc.).

Particular configurations of a system may offer a user the opportunityto make different or additional sensitivity adjustments, such as tofine-tune the frequency range a given detection tool will detect in asignal. Instructions on how to use a particular sensitivity adjustmentand/or the likely effect of moving in one direction or the other (i.e.,more or less sensitive), may be described for the user in the context ofthe simulation itself (e.g., on the programmer) and/or in a user'smanual. A system may be configured to play on a programmer or over awebsite a demonstration of how a user might select region(s) ofinterest, baselines, signals on which to run simulations, and then how auser might use the available sensitivity adjustments to refine a set ofautomatically-derived parameters to best satisfy the user's intentionsregarding detection and his or her patient.

Embodiments in which systems or methods automatically derive a set ofparameters values and/or automatically select which parameters to use,for a half wave detector will now be described with reference to FIGS.1-24.

A half wave detector (sometimes referred to as a type of “waveformmorphology analyzer”), looks for and counts “half waves” when they occurin a predetermined window of time in an electrographic signal (e.g., asignal corresponding to a time-varying field potential differencebetween two electrodes, at least one of which is implanted in or on apatient's brain). What constitutes a half wave that should be counted isdefined so that the counts that result from running the algorithmroughly correlate to the power of the signal at a particular dominantfrequency (or in a particular frequency band). A half wave detector isuseful, for example, in applications of an implantable medical devicesystem to detect electrographic activity corresponding to epileptiformactivity or the onset of a seizure. It should be appreciated that a halfwave detector may be used in analyzing waveforms corresponding tophysiological data sensed from a patient for different types of activityor different features in the sensed data. For example, when the patienthas epilepsy, some instances of a waveform analyzer implemented as ahalf wave detector may be configured to detect rhythmic activity when itoccurs in electrographic signals monitored from the patient and otherinstances of a waveform analyzer implanted as a half wave detector maybe configured to detect spike complexes when these occur in theelectrographic signals. Thus, the parameters and the values for theparameters may vary for different iterations of the same detection tool,depending upon the nature and type of activity each iteration of thetool is intended to detect.

With reference to FIG. 1A, in one embodiment of a half wave detector190, there may be seven programmable parameters to define the half wavedetection: namely, a half wave hysteresis parameter 191, a minimum halfwave amplitude parameter 192, a minimum half wave width parameter 193, ahalf wave count criterion parameter 194, a half wave window sizeparameter 195, a qualified analysis window count parameter 196, and adetection analysis window size parameter 197. These seven parameters maybe thought of as being part of the “parameter space” for a tool todetect half waves in a signal.

“Half waves” generally, as well as half wave hysteresis, will now bedescribed with reference to FIGS. 1B and 2. A waveform 100 correspondsto an electrographic signal after the electrographic signal has beenpre-processed and quantized (i.e., subjected to pre-processing andconditioning such as filtering to remove low and high frequency energyand sampling by an analog-to-digital converter). The y-axis correspondsto units of amplitude (which may ultimately be correlated to voltage orcurrent), and the x-axis corresponds to units of time, more particular,fractions of a second.

If a half wave of the waveform is defined generally as the excursion ofthe signal over time from a local minimum to a next local maximum or,alternatively, from a local maximum to a next local minimum, it will beappreciated that in FIG. 1B there are six half waves 110, 120, 130, 140,150, and 160 (associated with the dashed lines) in the waveform segment170 that extends over about a 60 ms interval between about 16.47 and16.53 s.

A given half wave may be characterized by an amplitude and a width, suchthat a half wave amplitude is the difference between the local maximumand minimum amplitudes, and the half wave width is the period of timefrom the beginning of a half wave to the end of the half wave. A halfwave further may be characterized by a direction based on whether theslope of the half wave is positive or negative (determined from thepositions of the starting point and ending point of a given half wave onthe horizontal axis as compared to the vertical axis). In FIG. 1B, forexample, the half wave 110 has an amplitude 172 of about 130 units (fromabout +100 units to about −30 units), a width 174 of about 20 ms (fromabout 16.47 s to about 16.49 s), and a negative slope. Accordingly, inFIG. 1B, a half wave #1 110 may be represented by a vector correspondingto the dashed line from the local maximum at the starting point 176 tothe next local minimum at the ending point 178. At the point 178, thewaveform changes direction, with a positive slope towards point 179 thatmarks the end of the half wave #2 120 and the beginning of the half wave#3 130. The points 180, 182, 186, and 188 define the end of the halfwave #3 130 and the beginning and end of the half wave #4 140, the halfwave #5 150, and the half wave #6 160, respectively.

It may be desirable to configure a given half wave algorithm to ignoresome half waves that are deemed to be insignificant variations (or smallperturbations) in the waveform so that these will not, in fact, berecognized by the detection tool as half waves. In a half wave detector,this may be accomplished by defining a value for a hysteresis parameter191 in the half wave detection algorithm. In FIG. 1B, features of thewaveform that are deemed to constitute insignificant variations in theelectrographic signal might correspond to the half wave #2 120, the halfwave #3 130, the half wave #5 150, and the half wave #6 160. These halfwaves might be, for example, deemed to be inconsistent with the overallmovement of the electrographic signal, and/or attributed toperturbations in the signal that result from quantizing of noise orother low-amplitude signal components of the sensed physiologicalsignal.

Thus, a hysteresis setting may correspond to allowing some half waves inthe direction of movement of the waveform to be disregarded and thus nottreated as a reversal of direction that warrants identifying thereversal of direction point as the starting (or ending) point of a halfwave. A hysteresis allowance in a detection algorithm can be used, forexample, to avoid having to subject the physiological signals beingsensed from the patient to more rigorous processing and conditioningbefore the signals are introduced to the algorithm.

The effect of specifying a value for a hysteresis parameter may beappreciated with reference to FIG. 2. FIG. 2 represents the samewaveform 100 of FIG. 1B, but now there are only two dashed linesrepresenting vectors corresponding to two half waves in the waveformsegment 170. More particularly, one half wave 202 (hereinafter referredto as second half wave 202 in FIG. 3) extends from a starting point 176to an ending point 180, and another half wave 208 (hereinafter referredto as third half wave 202 in FIG. 3) extends from the point 180 toanother half wave ending point 188. In this example, the half wavehysteresis parameter 191 has been set to specify a minimum amplitudethat the waveform has to exceed when it transitions from one directionto the other (e.g., positive to negative slope) before the half wavewill be considered to represent the start or end of a half wave. Morespecifically, in the example of FIG. 2, the half wave hysteresisparameter 191 has been set to a value of 50 amplitude units such that,if after the signal comprising the waveform changes slope, the amplitudeof the half wave never exceeds 50 amplitude units before it changesslope again, no half wave will be deemed to have ended or begun. Sincethe half wave #2 120, the half wave #3 130, the half wave #5 150 and thehalf wave #6 160 shown in FIG. 1B each are characterized by an amplitudeof less than 50 units, when the half wave hysteresis parameter has beenset to a value of 50 amplitude units, each of these half waves will beignored in determining which and how many half waves are present in thewaveform segment 170. Thus, the half wave 202 (the second half wave 202in FIG. 3) has an amplitude of about 150 units (from about +100 units toabout −50 units on the vertical y-axis) and a half wave width of about30 ms (from about 16.47 s to about 16.50 s), and a negative slope. Thehalf wave 208 (the third half wave 208 in FIG. 3) has an amplitude ofabout 100 units (from about −50 units to about +50 units) and a halfwave width of about 30 ms (from about 16.50 to about 16.53 s) and apositive slope.

In addition to using parameters and values for the same to decide when ahalf wave will be deemed to begin and end, parameters are used todetermine which half waves occurring in a given processing window are tobe considered “qualified half waves,” such that they will be treated ina particular way by the algorithm. A processing window may be defined asbeing that which is appropriate for the circumstance, given thespecifications of the relevant hardware and software. By way of example,a processing window specified for a half wave detector may correspond toa 128 ms window, which may in turn represent 32 samples of thephysiological data (e.g., of an electrographic signal sensed from thepatient) at a 250 Hz sampling rate.

Generally, a half wave will be considered a “qualified half wave” if itsamplitude exceeds the value selected for a minimum half wave amplitudeparameter 192 and a minimum half wave width parameter 193.Alternatively, if one or both of a maximum half wave amplitude parameterand maximum half wave width parameter are available for selection, ahalf wave may be considered a “qualified half wave” if its amplitudeexceeds the value selected for a minimum half wave amplitude parameter192 but does not exceed the value selected for a maximum half waveamplitude, and its width exceeds the value selected for a minimum halfwave width parameter 193 but does not exceed the value selected for amaximum half wave width. The range of values from which a value for theminimum half wave amplitude parameter 192 may be selected normally willbe consistent with the range of possible amplitudes for the waveformcorresponding to the sensed physiological data. In the example of FIG.3, and with reference to the y-axis of FIG. 3, the range of possibleamplitudes is +/−512 units of amplitude.

The minimum half wave width parameter 193 is the parameter thatdetermines what maximum frequency represented in the waveform will bedetected by the half wave detector. The range of values from which avalue for the minimum half wave width may be selected normally will bebetween 0 ms (corresponding to 125 Hz for a sampling rate of 250 Hz) and400 ms (corresponding to approximately 1 Hz for a sampling rate of 250Hz). Selection of a value for the minimum half wave width parameter 193will be driven, at least in part, by the rate at which the data issampled by the system. In an example, if a signal is being sampled at250 Hz, then each sample will be 4 ms apart. If the value of the minimumhalf wave width is set at 4 ms, then each half wave would have to lastlonger than 4 ms in order to be considered a qualified half wave. Sinceeach sample is 4 ms, then a qualified half wave would have to endure fortwo samples, which would correspond to an effective minimum half waveduration of 8 ms. If a whole wave is defined as comprising twoconsecutive qualified half waves characterized by opposite slopes, thena whole wave would have to be represented by four samples of 4 ms each,or 16 ms total.

For an electrographic signal sensed from a patient and quantized by aneurostimulator such as the RNS SYSTEM, the frequency of the signal maybe approximated as the inverse of the duration of a whole wave. In anexample, if a whole wave takes four 4 ms samples to be represented, andsince 1/16 ms is 62.5 Hz, a half wave detector with the value of theminimum half wave width parameter set at 4 ms will not be configured todetect the activity in an electrographic signal that is characterized bya frequency of greater than 62.5 Hz.

Referring now to FIG. 3, the waveform 100 is shown extending from about16.44 s to about 16.64 s (or for about 200 ms). The half wave hysteresisparameter 191 is set at 50 units, such that a transition in the waveformthat corresponds to a increase or decrease in amplitude of less than 50units will not be identified as a discrete half wave but rather will beincluded as part of a greater amplitude half wave. There are eleven halfwaves in the waveform 100, namely, a first half wave 302, the secondhalf wave 202 (first shown in FIG. 2), the third half wave 208 (firstshown in FIG. 2), a fourth half wave 316, a fifth half wave 318, a sixthhalf wave 320, a seventh half wave 322, an eighth half wave 324, a ninthhalf wave 326, a tenth half wave 328, and an eleventh half wave 330.

If the minimum half wave amplitude parameter 192 is set at a value of100 units and the minimum half wave width parameter 193 is set at avalue of 4 ms, then with reference to Table 1 below, only seven of theeleven half waves in the waveform segment 300 will constitute “qualifiedhalf waves,” namely, the second half wave 202, the third half wave 208,the fourth half wave 316, the fifth half wave 318, the ninth half wave326, the tenth half wave 328, and the eleventh half wave 330. That is,only seven of the eleven half waves meet or exceed the thresholds ofboth the minimum half wave amplitude parameter 192 and the minimum halfwave width 193.

TABLE 1 First Second Third Fourth Fifth Sixth Seventh Eighth Ninth TenthEleventh Half Half Half Half Half Half Half Half Half Half Half WaveWave Wave Wave Wave Wave Wave Wave Wave Wave Wave 302 202 208 316 318320 322 324 326 328 330 Minimum No Yes Yes Yes Yes No Yes Yes Yes YesYes Half Wave Amplitude (100 counts)? Minimum Yes Yes Yes Yes Yes No NoNo Yes Yes Yes Half Wave Width (4 ms)? Qualified No Yes Yes Yes Yes NoNo No Yes Yes Yes Half Wave?

For example, while the first half wave 302 exceeds the 4 ms thresholdvalue for the minimum half wave width parameter 193, it does not alsoexceed the 100 count threshold value for the minimum half wave amplitudeparameter 192, so the first half wave 310 is not identified as aqualified half wave. Similarly, the sixth half wave 320 exceeds the 100count threshold value for the minimum half wave amplitude parameter 192,but it does not exceed the 4 ms threshold value for the minimum halfwave width parameter 193, so the sixth half wave is not identified as aqualified half wave. Each of the second half wave 202, the third halfwave 208, the fourth half wave 316, the fifth half wave 318, the ninthhalf wave 326, the tenth half wave 328, and the eleventh half wave 330satisfy both the minimum half wave amplitude parameter 192 and minimumhalf wave width 193 thresholds, so each of these seven half waves isidentified as a qualified half wave.

Two other parameters that may be specified for a half wave detectorrelate to the how much of a given frequency has to occur, at a minimum,in a particular time period in order for the algorithm to determinewhether to register something as having been ‘detected’ (e.g., the onsetof epileptiform activity in the patient). These two parameters will bedescribed with reference to FIG. 4 and include a half wave countcriterion parameter 194 and a half wave window size parameter 195. Thehalf wave count criterion parameter 194 and the half wave window sizeparameter 195 allow a half wave detector to identify a “qualifiedanalysis window”. Generally, the number of qualified half waves has toexceed the value selected for the half wave count criterion parameter194 during the time window defined by the value selected for the halfwave window size parameter 195, in order for the algorithm to considerthe circumstance a detection-worthy circumstance. When, in a given halfwave window with a duration specified by the half wave window sizeparameter 195, the number of qualified half waves exceeds the value forthe half wave count criterion parameter 194, then that analysis windowwhich contains the end of the half wave window is considered a“qualified analysis window”.

In one example, a value of 9 might be set for the half wave countcriterion parameter 194 and a value of 1 s (1000 ms) may be set for thehalf wave window size parameter 195. In the algorithm, these valueswould mean that at least 10 qualified half waves have to occur in 1 s(or at least five whole waves in 1 s) in order for the minimum frequencycriteria for detection to be considered to have been met (five wholewaves in one second corresponds to a frequency of 5 Hz).

In another example, a value of 6 might be set for the half wave countcriterion 194 and a value of 200 ms might be set for the half wavewindow size 195. Referring now to FIG. 4, at the base of the graph alongthe x-axis (time in seconds), three sets of double-headed arrowsindicate three consecutive processing or analysis windows of 128 mseach, namely, analysis window #1 405, analysis window #2 407, andanalysis window #3 409. Analysis window #1 405 begins at about 16.40 sand ends at about 16.53 s, analysis window #2 407 runs from about 16.53s to about 16.66 s, and analysis window #3 409 runs from about 16.66 sto about 16.79 s.

Based on a half wave hysteresis parameter 191 set at 50 units ofamplitude, minimum half wave amplitude parameter 192 set at 100 counts,and a minimum half wave width parameter 193 set at 4 ms, the algorithmidentifies and counts qualified half waves within a 200 ms half wavewindow 440 that ends at about 16.64 s. Since there are seven qualifiedhalf waves in the 200 ms half wave window 440 (see also FIG. 3 and Table1 and the descriptions thereof), then the minimum frequency fordetection has been met (more than 6 qualified half waves counted in ahalf wave window of 200 s). When the seventh qualified half waveoccurred, the system was in the second 128 ms analysis window shown inFIG. 4, or analysis window #2 407. Thus, analysis window #2 407 is a“qualified analysis window”.

In some embodiments, a half wave detector may allow values for twoadditional parameters to be specified which are used in an effort tomake the algorithm detect only those patterns occurring in a waveformthat exhibit a certain consistency and duration. These parameters arethe qualified analysis window count (X) 196 and the detection analysiswindow size (Y) 197. The values for these parameters are selected sothat the half wave detector will only deem a detection-worthycircumstance to exist if a sufficient number (X) of qualified analysiswindows have appeared in Y of the most recent analysis windows.

This type of analysis generally may be referred to as an “X of Y”criterion. Such an “X of Y” criterion may be used in the half wavedetector described here to avoid having the detector trigger oncircumstances that are considered too spurious to warrant detection. Inan example, a value for the qualified analysis window count 196parameter may be 2 and a value for the detection analysis window size197 may be 1024 ms (where the detection analysis window size representsa number of consecutive analysis windows of equal size (for example,eight consecutive analysis windows of 128 ms would correspond to adetection analysis window size of 1024 ms).) With these values, applyingan “X of Y criterion” would mean that the minimum frequency fordetection (minimum number of qualified half waves occurring in the halfwave window size) would have occurred in at least two of the eight mostrecent 128 ms-analysis windows in order for the algorithm to deem acircumstance to exist that is worthy of detection.

A half wave detector is just one of several possible algorithms or toolsthat may be applied to physiological data (e.g., electrographic signalssensed from electrodes placed in or on a patient's brain) in order todetermine whether a condition of interest (e.g., a certain pattern ofactivity) occurs in the data. Multiple algorithms may be used incombination to analyze the same data, or additional algorithms mayinvolve comparing or contrasting the results of analyzing data with onetool with the results of analyzing different data (e.g., data occurringlater in time or data sensed from a different channel or from adifferent type of sensor (and/or using a different sensing modality,such as voltammetry rather than field potential measurements)). Theoutput of one or more algorithms such as a half wave detector output maybe used as one or more inputs to a finite, time-dependent state machinefor determining whether a pattern or patterns occur in a particularsequence or sequences.

It will be appreciated that, even in a simple case, where only a halfwave detector is used to analyze an electrographic signal sensed fromthe patient, it is a non-trivial task to accurately specify the valuesfor the seven parameters used by the algorithm (namely, the half wavehysteresis parameter 191; the minimum half wave amplitude parameter 192and the minimum half wave width parameter 193 (for identifying qualifiedhalf waves and establishing the maximum frequency for detection), thehalf wave count criterion parameter 194 and the half wave window sizeparameter 195 (for establishing a minimum frequency for detection); andthe qualified analysis window count parameter 196 and the detectionanalysis window size parameter 197 (for establishing an “X of Ycriterion” for detection).

It is not an intuitive exercise for a user to look at an existingtime-series electrocorticographic signal (or a spectrogram of such asignal) and to decide what values to assign to each of these sevenparameters in order to tune a half wave detector so that it will detectin future signals a particular type of activity that is represented inthe existing signal. It is true that systems like the RNS SYSTEM allow auser to “test run” algorithms with a given set of parameter values usinga simulator and display provided in an external component (i.e., a“programmer”) before the parameter values are actually programmed intothe patient's implanted neurostimulator. Nevertheless, the lack ofintuitiveness of the process of matching up the type of activity orpattern the user can see on a display with the appropriate values, forexample, for the “half wave count criterion parameter” and the “halfwave window size parameter”, often requires some trial and error beforethe user is satisfied that a given set of values will detect what theuser wants the implanted neurostimulator to detect when next thatactivity actually occurs in the patient. Thus, a system would be moreuser-friendly if the selection of parameter values for a given algorithmused in detection was an automated process or at least a partiallyautomated process.

FIG. 5 is an example of an electrographic signal 500 that might besensed from a patient and processed by an implantable neurostimulator.For instance, a signal such as that shown in FIG. 5 might correspond toa signal acquired such as on an active sensing channel of implantablemedical device which is configured to receive a bipolar signalrepresentative of the difference in electrical potential between twoselectable electrodes, at least one of which is implanted in or on thepatient's brain (the second electrode may also be implanted in or on thepatient's brain (e.g., on the same distal portion of a lead as the firstelectrode) or may be a reference electrode (e.g., the conductive outerhousing of the neurostimulator)). A signal of the type shown in FIG. 5may be retrieved from a memory of the implanted neurostimulator or ofthe external programmer component or from the central database.Alternatively, the signal shown in FIG. 5 may correspond to that whichis captured on a screen while the signal is being monitored in real timeby an external component that is in wireless communication with animplanted neurostimulator.

The graph of FIG. 5 is a time-series representation of theelectrographic signal, with the x-axis representing time and the y-axisrepresenting the amplitude of the signal. A user familiar with reviewingelectrocorticographic data from a patient of this sort may easily beable to identify a region of interest or “ROI” based on the graphicalcontent of the signal, for example, a region of interest demarcated bythe double-headed arrow 520 and beginning at a time of about timet_(ROI-i) 522 and lasting until about time t_(ROI-f) 528. In thisparticular example, a typical user would likely appreciate that thegraphical content of the region of interest 520 includes high rhythmicactivity as compared to a baseline level of activity and which precedeshigher amplitude synchronous activity, which is often typical of seizureactivity as recorded using intracranial electrodes. (In some systems,such as the RNS SYSTEM, detection may be used as a trigger for sometherapeutic action, such as delivering electrical current stimulation tothe patient from the neurostimulator in an effort to interrupt a seizureor to prevent it from fully developing. In these systems, then, and asin the example of FIG. 5, a region of interest 520 may be selected asone that defines the transition between non-seizure activity and seizureactivity, in other words, the onset of a seizure. In a situation wheredetection is undertaken as part of a diagnostic process (as opposed tobeing used as a trigger for delivering therapy), then a region ofinterest may be selected by a user that is within the seizure activityregion 530.)

In FIG. 5, the region indicated by the double-headed arrow 530 may bedeemed to be a region corresponding to seizure activity, and the regionindicated by the double-headed arrow 540 may be deemed to be a regioncorresponding to baseline activity. The baseline activity region 540 maybe one that begins at a time of about t_(B-l) and extends until at leasta time of about t_(B-f). (In some embodiments, the length of time overwhich the baseline activity occurs is less relevant than the nature ofthe activity occurring within that time period, as will be apparent fromthe description below.)

It should be appreciated that FIG. 5 is intended to illustrate generallya region of interest 520 and generally a region of baseline activity 540in a signal, and that the actual makeup or content of a region ofinterest 520 and the actual makeup or content of a region of baselineactivity 540 may vary widely from application to application, based, forexample, on the objectives of the user/physician with respect to his orher patient(s). More particularly, the region of interest 520 in FIG. 5is meant to represent a region of highly rhythmic activity. In otherapplications, or in the same application but for other instances of adetection tool, a region of interest may constitute a type of activityother than rhythmic activity or a type of activity that includes bothrhythmic activity and another type of activity. For example, describedbelow with reference to FIG. 22C is a circumstance in which a region ofinterest is selected that exhibits one or more spike complexes, alone orin combination with rhythmic activity. Generally, in systems and methodsaccording to embodiments, a user can select a region of interest basedon its graphical content, without regard to the set of operatingparameters for a detection tool that might be used to detect thatgraphical content. Put another way, a user can use graphical detectionto program the implant as to what it ought to detect, without an indepth understanding of the parameters a detection tool needs to actuallyaccomplish such detection.

In some embodiments, a user may be able to select a region of interestin a given electrographic signal by clicking and dragging a mouse overthe display of the electrographic signal on an external component suchas the programmer or on a web page of a website. Other methods ofselecting a region of interest will be apparent (such as using fingersor a stylus to make a selection on display of a “touch screen”, or byusing key strokes on a keyboard, etc.).

In some embodiments, the user may also be able to select one or moreregions of baseline activity 540 by clicking or dragging or otherwise.Alternatively or additionally, a region of baseline activity 540 may beautomatically selected by the system or set to some default value orrange of values by the system. If the system selects a region ofbaseline activity 540, then the system ultimately may or may not use thebaseline activity region selected in automatically deriving a parameterset. For example, if the system initially selects a region of baselineactivity 540 that turns out to be not that much different than thecontent of a region of interest 520 in one or more respects, then thesystem ultimately may not base the derivation of any parameter in theparameter set on what is contained in a baseline activity region 540.

FIG. 6 illustrates an example of a screen 600 that might be displayed toa user (e.g., on the display of an external component such as aprogrammer or on a web page viewed via a website) when the user hasselected one or more regions of interest 520, the method forautomatically deriving a parameter set has been accomplished for theselected region(s) of interest, and the type of activity the detectiontool would ‘detect’ with the automatically derived parameter set, basedon the selected region(s) of interest, is displayed to the user.

In the specific example of FIG. 6, a portion 601 of a screen is labeled“ECOG Display” and depicts a single user-selected region of interest 603extending from between about 40 s and about 43 s. (While it will beappreciated that an ECOG display such as the screen portion 601 may alsodisplay any regions of baseline activity selected by a user or by thesystem, no regions of baseline activity are depicted in the exampleshown in FIG. 6: An automatic-parameter-value-deriving-algorithm may notrequire any region of baseline activity in order to identify a set ofparameters for a given detection tool).

As soon as the user selects region(s) of interest, a method forautomatically deriving a parameter set for a detection toolautomatically derives values for relevant parameters of a relevantdetection tool and updates or overlays the ECOG Display with asimulation that reflects what the automatically derived parameter valuesused with the relevant detector would detect based on the features orpatterns that are present in the user-selected region(s) of interest.

In the example of FIG. 6, after the user selects the region of interest601, in the ECOG Display 600, the simulation shows a simulated detectionregion 608 which extends from within the region of interest 601 to theright of the region of interest 601 on the graph 610 (a time-seriesplot). Thus, the user is provided with visual feedback (by way of thesimulation) almost immediately after the computer makes choices for thevalues of the parameters for the relevant detection tool. The visualfeedback shows the user the nature and type of activity that would bedetected if those parameter values were programmed into theneurostimulator. If the relevant detection tool happens to be a halfwave detector configured to look for rhythmic activity, the user neednot have an appreciation for what value the method has identified, forexample, for the qualified analysis window count. Rather, the user cansimply view the simulation, compare it to the graphical content of theregion(s) of interest selected, and decide whether theautomatically-derived values are close enough to the mark.

The top graph 610 of the two graphs 610, 620 in the display 600 is atime-series representation of an electrographic signal 602, similar tothe time-series representation of the electrographic signal 500 in FIG.5 from which the user selected the region(s) of interest. The greyportion 608 of the top graph 610 demarcated by the double-headed arrow606 between a time t_(sim-l) and a time t_(sim-f) represents the natureand type of electrographic activity that would be detected if the halfwave detector were to be programmed with the parameter values the systemautomatically derived.

The bottom graph 620 of FIG. 6 is a spectrogram corresponding to thetime-series representation. Here, the spectrogram is another way tovisualize how much of the signal is characterized by certain frequenciesas the signal varies with time. For example, in the electrographicsignal 602 between of about 40 s and about 90 s (demarcated by thedouble-headed arrow 606), there is a concentration of power in thesignal around or below 50 Hz, as represented by the lower, darker region632 of the bottom graph 620 of FIG. 6 between the same times.

After a set of operating parameters for a detection tool has beenautomatically derived in accordance with embodiments, the user may beafforded the opportunity to adjust one or more values in the parameterset. Again, the user need not have an appreciation for the relevance ofeach discrete operating parameter to the function of the relevantdetection tool in order to accomplish these adjustments. Rather, theparameters in the set of operating parameters for the detection toolwill be ordered for the user in a manner significant to the graphicalcontent of the region of interest, such that if the user adjusts theparameters, the adjustment will predictably result in more or less ofthe graphical content in the region of interest being detected in thesubsequent simulation. Specific examples of options for a user to adjustdetection tool parameter values are described below.

In the display represented in FIG. 6 there are two sliders 640, 650. Theslider 640 is labeled “signal amplitude” and the slider 650 is labeled“pattern duration.” Each slider 640, 650 is provided with arectangular-shaped indicator 642, 652 and a pair of single-headed arrows644/646, 654/656 (one arrow at each end of the slider) to indicatedirection.

The left-facing arrow 644 of the signal amplitude slider 640 isassociated with less sensitive detection of the desired signal byrequiring the signal to meet a higher half wave amplitude threshold(e.g. increasing the minimum half wave amplitude parameter 192). Fromthe user's point of view, however, moving the rectangular-shapedindicator 642 towards the left-facing arrow 644 will simply result in“detecting less” of the signal corresponding to the graphical content(e.g., the pattern) in the user-selected region of interest. When thesimulation is refreshed with the adjusted minimum half wave amplitudeparameter 192, the user will see in the simulation between the timet_(sim-l) and the time t_(sim-f) in the graphs 610, 620 of FIG. 6 thatthe system is rejecting (e.g. not detecting) the parts of the signalwith smaller amplitude. The user can expect the behavior of the systemto, in this case, detect less of a pattern in a region of interestwithout having an appreciation that the reason why the detector isdetecting less is because the value of the minimum half wave amplitudeparameter of the half wave detection tool configured to detect rhythmicactivity was changed.

The right-facing arrow 646 of the same “signal amplitude” slider isassociated with a more sensitive detection of the desired signal bylowering the value of the minimum half wave amplitude parameter 192.Moving the rectangular-shaped indicator 642 towards the right-facingarrow 646 results in “detecting more” of the signal in the simulationover the t_(sim-l) to t_(sim-f) period by detecting the parts of thesignal with smaller amplitude. Again, the user need not understand thatwhen he moves the indicator 642 in the “signal amplitude” slider to theright, the minimum half wave amplitude parameter is changing. Rather,the user will appreciate that when he moves around in the slider to theright, then the detector will reconfigure itself to detect more of thepattern the user saw in the region of interest the user selected.

In an embodiment, a user is able to slide the indicator 642 within theslider 640 (e.g., by clicking and dragging or by selecting the left- orright-facing arrows (644/646)) to adjust the sensitivity of thealgorithm to be biased towards detecting higher or lower amplitudeactivity having characteristics like the signal in the simulationbetween t_(sim-l) to t_(sim-f). Accordingly, by moving an indicatoraround within a slider such as the slider 640, the user can test theeffect of adjusting one of the operating parameters for a givendetection tool without having to understand what that parameter is for(e.g., a “minimum half wave amplitude parameter”) and without having tochoose a specific value for that parameter (e.g., 50 amplitude units or100 amplitude units, etc.) and without having to understand which valuethe system and method has selected for that parameter.

With regard to the pattern duration slider 650 shown in the display 600of FIG. 6, the left-facing arrow 654 is associated with detecting“longer events” and the right-facing arrow 656 is associated withdetecting “brief events”. A user is able to slide the indicator 652within the slider 650 to adjust the sensitivity of the algorithm to bebiased towards starting to detect a pattern of activity like the patternof activity in the simulation between the time t_(sim-l) and the timet_(sim-f) earlier or later (e.g. by adjusting the qualified analysiswindow count 196 and detection analysis window size 197 parameters).

The user's sliding of one of the signal amplitude indicator 642 or thepattern duration indicator 652 may cause the system to adjust the valueof one or more of the parameters that were previouslyautomatically-derived from the user's selected region(s) of interest andsimulated in the simulation. Alternatively or additionally, the user'ssliding of one of the indicators 642, 652 may cause the system tointroduce one or more additional parameters (and corresponding valuestherefore) to be used by the algorithm. In some embodiments, whenever auser moves one of the indicators 642, 652, the display will refresh witha new simulation to indicate to the user what effect the sensitivityadjustment will have on the nature and type of activity the adjustedalgorithm will detect.

It should be appreciated that other “sensitivity” adjustments may beimplemented using sliders such as sliders 640, 650. For example if thedetection tool is a line length detector, then a slider may refer to apercentage threshold, such that moving the indicator around in theslider results in changing a percentage threshold requirement, which mayincrease or decrease the sensitivity of detection. More particularly, auser may understand that when an indicator in a “percentage threshold”slider is moved in the direction of a left-facing arrow then theparameters of the detection tool will automatically be adjusted so thatthe detection tool will increase the threshold to detect only largerchanges. Correspondingly, if the slider is moved in the direction of aright-facing arrow in a “percentage threshold” sensitivity adjustment,then the parameters of the detection tool will automatically be adjustedso that the detection tool will decrease the threshold to detect smallerchanges in addition to larger changes.

Moreover, in some embodiments, one or more additional detection controlscan be made available to the user, for example, when a user checks a boxsuch as the box 658 on the display screen 600. These additional controlsmay allow the user to adjust the values of other parameters used by agiven detection tool without the user having to have an algorithm-levelappreciation for what each parameter is called or the effect it has ondetection.

For example, the detection frequency may be controlled by another“lower/higher frequency” slider 660, which is shown in the exampledisplay 600 of FIG. 6 below the “signal amplitude” slider 640 and the“pattern duration” slider 650. A rectangular-shaped indicator 662 in the“lower/higher frequency” slider 660 may be initially set at a locationin the slider corresponding to a peak frequency determined by anautomatic-parameter-value-deriving algorithm to be within theuser-selected region of interest 601. After a simulation has been run todisplay to the user the nature and type of activity that might bedetected with the relevant detection tool with thoseautomatically-derived parameter values, the user may determine that heor she wants to adjust the parameters corresponding to the frequency ofwhat activity will be detected by the detection tool so that activitycharacterized by a lower or higher frequency will be detected. Ratherthan having to think about which detection tool parameter has to beadjusted and what value the parameter(s) ought to be changed to, theuser may simply move the indicator 662 around in the “lower/higherfrequency” slider 660, review the resultant simulations, and use thisfeedback to determine whether to make further adjustments using the“lower/higher frequency” slider 660, whether to move on to anothersensitivity adjustment (i.e., a different one of the available sliders);or whether the detection tool is now configured to detect what the userwants the detection tool to detect when it next occurs in a signalsensed from the patient.

More particularly, by moving the indicator 662 in the “lower/higherfrequency” slider 660 towards the right-facing arrow 666, values forparameters of an instance of a half wave detector would be adjusted sothat the half wave detector would detect portions of signals thatexhibit higher frequencies (and thus the algorithm would become moresensitive to higher frequencies). Correspondingly, if a user moves theindicator 662 in the “lower/higher frequency” slider 660 towards theleft-facing arrow 664, values for parameters of the relevant instance ofthe half wave detector would be adjusted so that the half wave detectorwould detect portions of signal that exhibit lower frequencies (and thusthe algorithm would become more sensitive to lower frequencies).

Similarly, a slider may be used to further refine the detectionfrequency to be more or less specific. For example, if a method forautomatically deriving parameter values for a given instance of a halfwave detector has determined that there is a peak frequency of 30 Hzrepresented in a particular user-selected region of interest, a “lessspecific/more specific” slider 670 may be used to adjust how specific tothat peak frequency the user wants the results of detection by the halfwave detector to be. For example, where a peak frequency is 30 Hz, aless specific frequency range may be 20 Hz to 40 Hz, whereas a morespecific frequency range may be 25 Hz to 35 Hz. The user may move aroundin the “less specific/more specific” slider 670 by dragging theindicator 672 towards the left-facing arrow 674 or the right-facingarrow 676. Compared to an initial set of automatically-derived parametervalue(s) corresponding to the frequency range identified in a user'sselected region of interest, a less specific frequency range may resultin a greater number of detections overall (for example, by the relevanthalf wave detector), and a more specific detection frequency range mayyield fewer detections overall. In sum, with the “less specific/morespecific” slider 670 shown near the bottom of the sample display 600shown in FIG. 6, the user may ultimately settle on a set of parametervalues for a given instance of a detection tool (e.g., an instance of ahalf wave detector) that will result in the detection tool beingconfigured to detect different frequency ranges than the initialparameter set in order to detect the type of activity identified in theROI with more or less specificity.

In certain instances of a half wave detection tool, the specificparameters the values of which are adjusted using a slider (or otherfeature configured for manipulation by a user) may comprise combinationsof parameters, such as a combination of the half wave window size 195and half wave count criterion 194. In other embodiments, adjustment ofone slider may impact the available values of another slider. Forexample, adjustment of the “lower/higher frequency” slider 660 maychange the parameter values in the “less specific/more specific” slider670. The relevance to the method for automatically deriving parametervalues and subsequent user-initiated sensitivity adjustments thereto forcombinations of parameters for a detection tool is described in moredetail below.

In view of the foregoing, it will be apparent that any of thesesensitivity adjustments may be susceptible to use by a user in anynumber of ways, such as the sliders described above or via some othersuitable visual prompt. Indeed, any suitable feature designed to make asystem more “user-friendly” may be relied upon in embodiments to allow auser to fine tune the values for any one of the parameters (or thevalues for some combination of parameters) that are required for a givendetection tool or algorithm to operate on physiological data, withoutthe user having to appreciate which parameters of a detection tool arebeing adjusted or how the values of the same are being changed: theoptions are not limited to the examples of sliders described herein.

In some embodiments, the user will be able to test run the algorithmwith the automatically-derived parameter values on any desiredelectrographic signals. For example, the user may select one or morefiles containing electrographic signals that were previously-recordedfrom the patient, from other of the user's patients, or from a class ofpatients with similar demographics to the patient.

For example, and referring to a panel 679 designated as “ECOGThumbnails” on the right-hand side of the display 600 of FIG. 6, severalpreviously-recorded electrocorticograms (or “ECOG”s) 680 may bedisplayed to a user (there are six previously-recorded ECOGs shown inthe “ECOG Thumbnails” of FIG. 6), so that the user may observe theresults of running a detection tool simultaneously on the several ECOGsto see what kinds of activity the detection tool would be likely todetect with a given set of parameter values automatically derived basedon a region of interest (and based on a user's sensitivity adjustments,if applicable). Since the electrographic signals are never exactly thesame, for example, just before a seizure develops, even for the samepatient, the user can test a given parameter set on multiplepreviously-acquired ECOGs to test how consistently the algorithm willdetect the nature and type of activity the user wants the algorithm todetect in a variety of situations.

In some embodiments, the ECOGs shown in the “ECOG Thumbnails” panel 680may be a set of ECOGs that the user previously flagged to be ofinterest. In other embodiments, the ECOGs shown in panel 680 may be aset of ECOGs that are generated by filtering and or sorting through aset of ECOGs, where the filtering and sorting is accomplished based oncertain features. The filtering and sorting may be accomplished“manually” by a user as he or she searches and/or scrolls throughpossible ECOG candidates accessed on a database. Alternatively, thefiltering and sorting may be accomplished automatically by variousfiltering and sorting algorithms. Some combination of user-initiatedfiltering and sorting and computer-initiated filtering and sorting isalso contemplated.

One feature that might be used to sort ECOGs may be whether or notsaturation was present in the ECOG. (“Saturation” in apreviously-recorded ECOG may mean that the signal reflected in therecording had so much amplitude or otherwise so much power that itsaturated the electronics through which it was processed and acquiredfor recording, such that the signal, for example, corresponds to asensing amplifier pegged at a rail.) Another feature that might be usedin sorting ECOGs may be the time at which the ECOG was recorded or someother circumstance associated with its recording (for example, whetherit was recorded at night, whether it was recorded at the instance of thepatient as opposed to because the active implantable medical deviceautomatically recorded it as the result of running the signal sensedfrom the patient through a detection tool, etc.) In still otherembodiments, the ECOGs shown in the panel 680 may be automaticallyselected by the system for the user based on a selection algorithm thatindicates that these ECOGs may be of interest to the user.

FIG. 7 is another example of a display 600, representing an iteration ofthe automatically-derived parameter value set after a user has used the“signal amplitude” slider 640 by moving the indicator 642 further in thedirection of the “detect less” (left-facing) arrow 644. When the userasks for the algorithm to be reconfigured to detect less by requiringthe sensed signal to have a higher amplitude in order for the system torecognize a “detected event” to have occurred, then the algorithm willautomatically adjust one or more parameter values (or add one or moreparameters and associated parameter values) in an effort to comply withthe user's request. The simulation (to the right of the selected regionof interest 601 on the ECOG Display of FIG. 7) is refreshed based on theuser's use of the slider. More specifically, the result of thesensitivity adjustment can be appreciated in the time-seriesrepresentation of the electrographic signal 602 in the top graph 710 ofFIG. 7. The grey portion 708 of the top graph 710 indicates that, afterthe user asks the algorithm to “detect less” insofar as the amplitude isconcerned, the adjusted set of parameter values, if ultimatelyprogrammed into the patient's active implanted medical device for agiven instance of a half wave detector, likely would detect a noticeableamount less of the signal than would the set of parameter values thatresulted in the shaded portion 608 of the top graph 610 of FIG. 6.

It will be appreciated that there are a great many possibilities forallowing a user to interface with a method for automatically determiningand adjusting a parameter set for an activity type and/or a detectiontool according to embodiments. Screen shots from a variety of graphicaluser interfaces are included in FIGS. 23A-23E. More particularly, FIG.23A is an example of a user interface in which a user has selected aregion of interest (ROI) on a previously-stored ECOG signal sample, andan embodiment has determined that the region of interest containsrhythmic activity (i.e., the “detect rhythmic activity” option is shownchecked in the screen shot of FIG. 23A). This screen shot shows thesystem presenting the user an option to confirm or adjust the type ofactivity the user wishes to detect in the region of interest (e.g., theuser may choose “detect spiking activity” or “detect change in power”options instead of the system-selected “detect rhythmic activity”option).

FIG. 23B is an example of a user interface in which a user has selecteda region of interest (ROI) in a previously-stored ECOG signal sample andan embodiment has proposed an initial set of parameters for a half wavedetection tool. These detection parameters have been loaded into theuser interface and a simulation run to show the user what type ofactivity might be detected in a sensed signal with that parameter set.The user is presented with controls (upper left-hand corner of screenshot of FIG. 23B) with which the user can adjust or tune the detectionparameters in the set to change the activity the detection parameter setwill detect. For example, the detection parameters can be adjusted todetect “more events” or “fewer events” and/or to detect “longer events”or “brief events.”

FIG. 23C is an example of a user interface in which a user has selectedfour distinct regions of interest on a sample of a stored ECOG signal(or on multiple samples). The user interface presents the user withcontrols for adjusting detection parameters for a detection toolassociated with each of the four ROIs individually. The user interfacealso displays several thumbnail-sized ECOG signal samples. These allowthe user to assess how a given set of detection parameters will performon several different electrographic signals (i.e., what a detection toolconfigured with those parameters would detect if a sensed signal hadcharacteristics like those in each of the samples). The user may be ableto sort through the ECOG thumbnails for a particular patient by certaincriteria. For example, a doctor may be able to look through the ECOGsignals that have been stored for that patient (either on the user'sprogrammer or in a central database) in the previous thirty days. Incases where the patient is able to cause the implant to store ECOGsignals (for example, by waving a magnet near the implant), the doctormay be able to sort the ECOG signals according to whether the patient orthe implant caused them to be stored. In still another example, theimplant may have caused an ECOG signal to be stored (initially on theimplant and subsequently downloaded to the programmer or uploaded to thecentral database), based on some triggering event. For instance, theECOG signals may have been stored when a detection tool in the implantconfigured with a different set of operating parameters decided that an“event” should be deemed detected and the ECOG signal that triggered thedetection stored in the implant's memory. Many other ways of sortingthrough stored ECOG signals, including those associated with multiplepatients (e.g., of the user, or in a certain demographic, or with acertain seizure focus, etc.) are contemplated.

FIG. 23D is an example of a user interface in which a user is affordedthe opportunity to manipulate the set of detection parameters for adetection tool associated with each of four regions of interest on ansample of a stored ECOG signal (or on multiple samples of signals). Thedetection parameters in each set have been loaded into the userinterface and a simulation run to show the user what type of activitymight be detected in a sensed signal with each parameter set. The useris presented with controls (upper left-hand corner of screen shot ofFIG. 23B) with which the user can adjust or tune the detectionparameters in each set to change the activity the detection parameterset will detect. For example, each set of detection parameters can beadjusted to detect “more events” or “fewer events” and/or to detect“longer events” or “brief events.”

FIG. 23E is an example of a user interface in which a user has selectedfour distinct regions of interest on a sample of a stored ECOG signal(or on multiple samples). The user interface presents the user withcontrols for adjusting detection parameters for a detection toolassociated with each of the four ROIs individually. For example, theuser is offered controls for tuning the frequency and specificity ofwhat a given set of detection parameters will detect. The user is alsooffered a view of what are the actual parameters and the parametervalues that make up each of the four detection sets (e.g., “countcriterion”=12, “bandpass hysteresis”=12, etc.).

Embodiments of a system and method for automatically deriving theparameter values for a half wave detector will now be described withreference to FIGS. 8A-8C as well as with reference to FIGS. 1A, 5, 6 and7.

Generally, embodiments of the system and method are grounded on criteriafor choosing parameter values that are reasonably related to thefunction the parameters perform in a given algorithm or detection tool,such as detecting portions of signals that are at or above a minimumfrequency. For a given algorithm in which the number of parameters to bespecified in order to detect something is greater than one, as in thecase of a half wave detector like the half wave detector described above(in connection with which seven different parameters were described), itmay be useful to describe the parameters as occupying a multidimensionalparameter space, wherein relationships among the parameters are suchthat it makes sense to specify two or more of the parameter valuestogether, as opposed to trying a value for each parameter one parameterat a time to see how close the result of what the algorithm detects withthose values comes to what the user chose as something the user wants todetect. The manipulation of the parameters in the relevant parameterspace is accomplished without requiring any input from the user beyondthe user's selected a region of interest containing some graphicalcontent the user would like a detection tool to be configured to detect.

In a simple example, a user may select a single region of interest or“ROI” in a previously-recorded sample of an electrographic signal sensedfrom a particular patient. For example, and referring again to FIG. 5,the user may select the portion of the electrographic signal extendingfrom t_(ROI-l) 522 to t_(ROI-f) 528 as a region of interest 520. It willbe appreciated that the context most often will dictate a region ofinterest for a user. For example, a region of interest likely willappear to the user's eye to correspond to a kind of activity the userwants to detect whenever it occurs in the patient. When the user wantsto detect electrographic activity in a patient who has seizures for somepurpose related to treating the seizures before they can fully develop,the user may select a region of interest 520 that precedes anotherregion of activity that is believed to be associated with a seizure,such as the region 530 in FIG. 5, which is characterized by relativelyhigh amplitude, high frequency activity. In other cases in an epilepsyapplication, a user may want to select a region or regions of interestin which spike complexes occur. In still other cases the user may wantto tune a half wave tool to detect activity that corresponds to adifferent condition of the patient, such as to a tremor associated witha movement disorder. And since the physiological response may varybetween patients having the same or a similar condition, the region ofinterest a user may want to have a detection algorithm capture for onepatient may be different from the region of interest the user wants todetect for another patient having the same condition. The graphicalcontent of a particular region of interest may be appropriately referredto as a “pattern” in some applications, such as a spiking pattern or apattern of rhythmic activity. In other applications, the graphicalcontent of a particular region of interest may be characterized as adiscrete feature rather than as a pattern.

In more complex situations, a system according to embodiments may offera user the opportunity to combine more than one region of interest in apreliminary computation before asking a parameter-deriving algorithm toidentify a set of parameters and parameter values. For example, in somecases, a user may wish to select two or more regions of interest thatseem to exhibit very similar behavior but which are not identical. Whenthese similar regions of interest are combined in a computationpreliminary to selecting a set of values for the parameters for a givendetector, the algorithm used for such a preliminary computation may bebiased to provide a result that emphasizes commonalities in the selectedregions of interest and minimizes differences. Such a preliminarycomputation thus may effectively increase the “signal-to-noise” ratio ofthe portion of physiological data the user ultimately wants the detectorto detect (e.g., a pattern of activity in an electrographic signal thatappears to precede an electrographic seizure in the patient). Examplesof these similar types of activity in the same patient are describedmore fully with reference to FIG. 16A-16D and FIG. 17A-17C below.

In other cases, a user may want to use a preliminary computation torelate regions of interest to each other that are visually distinct butnonetheless deemed to be related to a state of the patient (for example,a patient's electrographic signals may exhibit different types ofactivity in different regions of the waveforms when the patient is aboutto have a seizure, where each different type of activity is deemedlikely to presage a seizure state). Examples of these different types ofactivity for different types of seizure onsets in the same patient aredescribed more fully with reference to FIG. 15A-15D, below.

Referring again to the case in which a user selects only one region ofinterest 520, the user or a computer may select a region of baselineactivity, such as the region of baseline activity 540 shown extendingbetween time t_(B-l) 542 and t_(B-f) 544 in FIG. 5. One way to thinkabout the regions of baseline activity is that each region of baselineactivity represents a type of activity that the user likely does notwant the detection tool to identify as something to detect when thattype of activity occurs. If a region of interest selected by a user ischaracterized by both some sort of baseline activity and a pattern thatthe user wants to detect, then selecting a region of baseline activityregion will ultimately result in parameter values being selected thatwill not cause the detector to detect when only the baseline activity ispresent (i.e., without the pattern).

If the user does not select one or more regions of baseline activity,the computer may select one or more regions of baseline activityautomatically, based on the user's selected regions of interest. Forexample, the computer may be configured to select a region of activitythat precedes the beginning of a user-selected region of interest by afew seconds, based on an assumption that if the user did not includethat activity within his or her selection of a region of interest, thenthis region of activity is something that the user does not want todetect, and therefore should be treated as baseline activity. Thisassumption may be an appropriate one in some applications and not inothers, and the computer may be programmed to determine whether and whento apply the assumption accordingly.

In another example, if the region of interest corresponds to what theuser believes is activity that represents the onset of epileptiformactivity (e.g., a “seizure onset” or “onset type”), then it may bereasonable to assume that the region of interest corresponds to atransition in an electrographic signal from a region that the user doesnot want to detect to a region (e.g., a pattern) where the user wouldlike detection. In this situation, then, the computer may select theactivity occurring just before the user-selected region of interest as aregion of baseline activity

In some embodiments, even when the user or the computer selects a regionof baseline activity, the baseline activity ultimately may not be usedby the system in determining a set of parameter values for the relevantdetection tool. Similarly, in some embodiments, a user may not bepresented with the option of selecting any region of baseline activity.

In other embodiments, the process the computer undertakes to identityregions of baseline activity may be more varied and complex.

In still other embodiments, a user may select only one region ofinterest but the user or the computer (or the user and computercombined) may select multiple regions of baseline activity. If multipleregions of baseline activity are selected, then the system can undertakesome preliminary computation relative to the several baseline activityregions in an effort to increase their relevance to the process ofautomatically deriving parameter values based on the region of interest.For example, a preliminary computation may combine information in thesignal in the selected baseline activity regions. Such a combination mayprovide more comprehensive information about the types of activity thatshould not be detected whenever those types of activity occur in thesensed physiological data, as contrasted to what type(s) of activityshould be detected (e.g, a pattern appearing in the activity in a regionof interest chosen by a user).

Referring now to FIGS. 8A-8C, methods for automatically determining theparameters and values for the same to be used by an instance of adetection tool (e.g., a detection tool to be implemented in an activeimplantable medical device) are described. FIG. 8A corresponds to theoverall flow of a method the result of which is to determine an initialset of automatically derived parameter values for a detection tool andto then offer the user an opportunity to adjust the sensitivity of theinitial set without having to understand exactly which parameters of thedetection tool are being adjusted or how. The sensitivity adjustmentsmay be offered to the user via user-friendly features (e.g., slidersimplemented on a graphical user interface).

More particularly, in FIG. 8A, a detection tool will be selected basedon the system's assessment of a type of activity the user seems to beinterested in detecting based on the composition of the user-selectedregion or regions of interest. For example, if the type of activity inthe user-selected region or regions of interest corresponds to rhythmicactivity or spiking activity, a half wave detector may be selected as adetection tool. If the type of activity in the user-selected region orregions of interest corresponds to a change in amplitude and orfrequency, a line length detector may be selected as a detection tool.

FIG. 8B is a flow diagram of a method when the system has determinedthat the activity is rhythmic activity and that the detection tool forlooking for the rhythmic activity will be a half wave detector. FIG. 8Cis a flow diagram of a method when the system has determined that theactivity represented by a region or regions of interest is spiking andthat the detection tool for looking for the spiking will be a half wavedetector. In each case, the system-selected half wave detector may beconfigured to monitor electrographic signals (e.g., sensed on one ormore channels of an active implantable medical device).

In FIG. 8A, the flow diagram indicates that, at block 802, a userselects a region of interest 520 or regions of interest 520 and,optionally, one or more regions of baseline activity 540. In anembodiment corresponding to FIG. 8A, if the user fails to select one ormore regions of baseline activity at block 802, then at block 804, thecomputer selects one or more regions of baseline activity 540. Thecomputer may or may not ultimately use the baseline region(s) in asystem and method for automatically determine a parameter set for agiven detection tool. It should be appreciated that, in someembodiments, selection of a region of baseline activity by a user andselection of a region (or regions) of baseline activity automatically bythe computer need not be mutually exclusive. A user may select abaseline and the computer may select another region of baselineactivity, with or without incorporating the user-selected region ofbaseline activity into a preliminary computation to establish a baselinefor the system and method that automatically derives a parameter set forthe detector.

At block 806, and if more than one region of interest 520 has beenselected at block 802, the system undertakes a first preliminarycomputation (denoted as “Algorithm A” in FIG. 8A), to determine whetherany or all of the selected regions of interest 520 should be furtherprocessed or operated upon before a region of interest 520 is used asthe basis for deriving a parameter set for a particular instance of adetection tool.

For example, if a user selects three regions of interest 520, the firstpreliminary computation may be to determine whether the three regions ofinterest have some common feature or features that suggest to the systemthat the user is interested in detecting a particular type of activity(e.g., rhythmic activity). In some embodiments, Algorithm A maydetermine that signals in the regions of interest are similar, such thatcombining the data may be advantageous (e.g., Algorithm A may determinethat the content of the three user-selected regions of interest shouldbe combined to support a single instance of a detection tool). Acombination of regions of interest may be advantageous, for example, toeffectively increase the “signal-to-noise” ratio of the portion ofphysiological data the user ultimately wants the detector to detect(e.g., a pattern of activity in an electrographic signal that appears toprecede an electrographic seizure in the patient). Ultimately, signalsdetected with a detection tool associated with a higher“signal-to-noise” ratio are likely to provide better information aboutthe condition of the patient.

In other cases, however, when a user selects multiple regions ofinterests, the signals in those regions may be so different (for exampledifferent physiological signals may be associated with different typesof seizures) that each would be better detected using detectors biasedfor detecting different types of activity (e.g., a detector biased todetect rhythmic activity versus a detector biased to detect activityrepresenting a significant power change in the signal). When suchdifferences are apparent to the system, in order to detect differenttypes of physiological activity, the system may ask the user to allow itto separate the regions of interest or portions of the signal and to usedifferent detection tools (or different instances of the same kind ofdetection tool with varying parameters or parameter values) to look forthe activity when it occurs in the patient. Alternatively in thesecircumstances, the system may opt to use a default tool or defaultparameters or default parameter values as is described further below.

If the first preliminary computation (Algorithm A) result is that theuser-selected region(s) of interest 520 should not be further processedor operated upon before being used as the basis for deriving a set ofoperating parameters for a detection tool, then in the process shown inFIG. 8A, at block 812, the system may query the user before proceedingfurther. For example, a user may select multiple regions of interestand, at block 806, Algorithm A may not be able to find significantfeatures in common (or enough features in common) among the differentregions in order to conclude that they be used in combination to choosea detection tool and then parameter values for that tool. In this case,the system may prompt the user to allow the system to segregate theuser-selected regions of interest in ways that make sense to it giventhe various options for detection tools the system is configured toprovide. For example, the system may ask the user if it can break theregions of interest up into one set that makes sense for the rhythmicactivity type, and another set that makes sense for the type of activitythat represents a power change in the sensed signal. If the user doesnot assent to the system's proposed grouping of the user-selectedregions of interest into such groups, then the system may select a moregeneric type of detector (e.g. in FIG. 8A, block 846, the power changedetector may be defined as the more generic type of detector). When apower change detection tool has been selected, then the method forautomatically deriving a parameter set either may automatically derivevalues for the parameters relevant to the power change detection tool(at block 846) or may populate some or all of the parameters withpredetermined default values (at block 850). In other embodiments,different options may be available for any or all of a default activitytype, a default detection tool, and default parameter sets for a defaultactivity type or detection tool.

If the first preliminary computation (Algorithm A) result is that theuser-selected region(s) of interest 520 should be further processed oroperated upon before being used as the basis for deriving parametervalues, then after the result of that preliminary computation isobtained, at block 830, an activity type algorithm (“Algorithm 1” inFIG. 8A) is used to select a type of activity represented in theregion(s) of interest. In FIG. 8A, three types of activity arecontemplated as possible results from an activity type algorithm,namely, rhythmic activity, spiking, and activity that represents achange in the power of the signal in the region(s) of interest. Itshould be apparent that an activity type algorithm may be configured toidentify other patterns and therefore other types of activity when theyoccur in a region of interest selected by a user.

Activity Type Analysis/Rhythmic-Spiking Power Change

A system and method that will automatically derive a parameter set for adetection tool based on a user-selected region of interest (e.g., aregion of interest in an EEG signal marked by a physician) may beconfigured to first determine a type of activity present in the regionof interest. For example, an automatic parameter derivation method mayuse an activity type algorithm (“Algorithm 1” in FIG. 8A) to determinewith high certainty whether the main pattern present in the signalcorresponds to a rhythmic activity (as opposed to, for example, spikeactivity). Such an activity type algorithm will be useful if a region ofinterest exhibits a distinct dominant pattern or other feature. When acombination of patterns is present in the region of interest, the systemmay prompt the user to make the decision on the type of pattern toconfigure the detector(s) to detect.

There are some typical EEG morphologies present at the onset of orwithin the body of EEG signals that are understood to correspond toseizures. These can be broadly categorized as: (1) rhythmic patternsthat can be slow or fast in frequency; and (2) spike trains that lead toa seizure or that can be present within a seizure. Desirably, an activeimplantable medical device that is configurable to detect patternsassociated with seizure activity would have detection algorithmssuitable for these two patterns (rhythmic or spike activity) as well asthe capability to detect other types of activity that may be associatedwith a seizure such as a sudden change in amplitude and/or a change infrequency. A generic detection system based on these two traits may beable to capture if not all, most of the previously unseen seizures andcould help complement the pattern specific detectors available forrhythmic and spike activity.

Working with a previously-selected ECOG (e.g., selected from the ECOGs680 displayed in the ECOG Thumbnails 680 of FIG. 6), the user selects aregion of interest based on a start and end time. For example, the usermay click on the selected ECOG at a time t_(ROI-i) 522 corresponding tothe beginning of a region of interest 520 and then drag until the userreaches a desired end for the region of interest at a time t_(ROI-f)528. A typical user-selected region of interest might span about 3 to 5seconds on the selected ECOG. Once the user has selected a region ofinterest, the system analyzes the region of interest to determinewhether a dominant activity type or pattern is present in the region ofinterest. Systems and methods according to embodiments may make thisdetermination base on one or more pre-determined approaches to such aclassification problem. These approaches may include, but are notlimited to, neural networks, SVMs (Support Vector Machines), clusteringtechniques, rule-based approaches, and genetic programming. A system maydecide which approach to use based on historical data concerningdistinctions between classes of activity occurring in ECOG signals.

In an example, 92 regions of interest were used to guide the selectionof features to differentiate across the two main pattern classes:rhythmic and spike activity. It is important to appreciate that a givenregion of interest may exhibit a combination of these patterns, or mayexhibit very periodic spikes that can be considered rhythmic (due totheir almost constant periodicity). Each graph in FIGS. 20A-20C is anexample of a signal that exhibits rhythmic activity. Each graph in FIGS.21A-21C is an example of a signal that exhibits spiking. And each graphin FIGS. 22A-22C is an example of a signal that exhibits a combinationof rhythmic activity and spiking.

Once the activity type algorithm has determined an activity type, then amethod for automatically deriving a parameter set for that activity typewill attempt first to select a detection tool from among the availableoptions for detection tools that correspond to the activity type. If themethod for automatically deriving parameter sets cannot find a goodoption, then the algorithm may select a default detection tool and, atblock 850, a default set of values for the relevant operating parametersfor the default detection tool. However, if the method for automaticallyderiving parameter sets can find a good option from among the availableoptions for detection tools that correspond to the activity type foundby Algorithm 1, then values will be chosen for the parameters theselected detection tool needs to run or operate.

In FIG. 8A, if the activity type algorithm identified rhythmic activity,then a method for automatically determining parameter sets will firstchoose a detection tool that is well-suited for detecting rhythmicactivity, and then choose parameter values for an instance of such adetection tool that biases the tool to look for the same kind ofrhythmic activity as in the user-selected region(s) of interest. If atblock 830, Algorithm 1 identified a spike or spikes as the activitytype, then a system and method for automatically determining a parameterset for a detection tool will first choose a detection tool that iswell-suited for detecting spikes and then choose values for theoperating parameters of an instance of that tool that will bias it tolook for the same spikes as occur in the user-selected region(s) ofinterest. If the activity type algorithm identified activityrepresenting a power change in the signal at block 830, then a systemand method for automatically determining a parameter set for a detectiontool will first choose a detection tool that is designed to detect powerchanges and then choose operating parameters and parameter values for aninstance of that power change detector that will tune it to look for thesame sort of power changes whenever they occur in the future signalssensed by the implant if the implant is programmed with that parameterset.

If the activity type algorithm cannot identify a type of activity in theuser-selected region(s) of interest, at block 850 the system mayestablish a detection tool by default. In this case, the system mayselect a default set of parameters for the tool to use together withdefault values for each parameter. In one embodiment, the defaultcondition may be a line length detection tool configured with parametersthat are configured to detect when a monitored signal exhibits a 50%increase in line length as compared to a recent trend for that signal'sline length.

In connection with FIG. 8B and FIG. 8C below, described are systems andmethods for automatically deriving a set of operating parameters for ahalf wave tool biased to look for rhythmic activity (FIG. 8B) and tolook for spikes (FIG. 8C). Also described below are systems and methodsfor automatically deriving a parameter set for detection tools that canbe biased to look for power changes in a region or regions of interest(e.g., a line length detection tool).

The detection type algorithm (Algorithm 1 at block 830 in FIG. 8A) mayevaluate the output of the first preliminary computation algorithm(Algorithm A) and determine that a region of interest or regions ofinterest 520 suggest that the pattern the user seems to be interested inis electrographic activity that constitutes rhythmic activity (as willbe described more fully below). In this scenario, the detection typealgorithm (Algorithm 1 at block 830 in FIG. 8A) may evaluate the outputof the first preliminary computation algorithm (Algorithm A) anddetermine, first, that a region of interest or regions of interest 520selected by a user suggest that the pattern the user seems to beinterested in is electrographic activity occurring at a relatively highfrequency (or in a range of frequencies that are relatively high). Inthis case, at block 830, the detection type algorithm will specify ahalf wave detector for rhythmic activity.

Next, at block 855, the system and method for automatically deriving aset of parameters (“Rhythmic Detection” in FIG. 8A) will identify aninitial set of values for the parameters necessary for the half wavedetector to run. The values selected will be such as to bias the halfwave detector to detect rhythmic activity similar to that which is foundin the user-selected region(s) of interest 520. FIG. 8B has additionaldetail on an embodiment for automatically deriving a set of operatingparameters for a half wave detection tool configured to look for (or“detect”) rhythmic activity.

Another pattern a half wave detector may be configured to detect maycorrespond to the occurrence of spiking activity in the signal. That is,the detection type algorithm (Algorithm 1 at block 830 in FIG. 8A) mayevaluate the output of the first preliminary computation algorithm(Algorithm A) and determine that a region of interest or regions ofinterest 520 suggest that the pattern the user seems to be interested inis electrographic activity that constitutes one or more spikes (as willbe described more fully below). In this case, at block 860, thedetection type algorithm will result in specification of a half wavedetector for spiking detection. Next, at block 860, the system andmethod for automatically deriving a parameter set (“Spiking Detection”in FIG. 8A) will identify an initial set of values for the parametersnecessary for the half wave detector to run. The values selected will besuch as to bias the half wave detector to detect activity similar tothat which is found in the user-selected region(s) of interest 520. FIG.8C has additional detail on an embodiment for a system and method forautomatically deriving a parameter set for a half wave detection toolconfigured to look for or detect spiking.

In still other embodiments, the algorithm for determining whether any orall of the selected regions of interest 520 should be further processedor operated upon before a region of interest 520 is used as the basisfor deriving a parameter set and values for the same (i.e., Algorithm Aat block 806 in FIG. 8A) may be run after a detection type algorithm hasbeen run. Alternatively, more than one algorithm for determining whethera selected region of interest should be combined with any other region(region of interest or baseline) or otherwise processed or operated uponmay be run at different times in the process of automatically derivingparameter values for a detection tool.

Rhythmic Activity/Half Wave Detector

Referring now to FIG. 8B, embodiments will be described of a system andmethod for automatically deriving a parameter set for a half wavedetector where the physiological data at issue compriseselectrocorticographic signals and the type of activity in the region(s)of interest has been determined to be rhythmic activity (for example, byan activity type algorithm such as Algorithm A in FIG. 8A).

First, and referring again to FIG. 5, a user selects a region or regionsof interest 520 from the time-series recording of an electrographicsignal 500 and either the user or the computer selects one or moreregions of baseline activity 540. The system and method generates orotherwise obtains a frequency spectrum corresponding to the dataencompassed by the user-defined region of interest 520(region-of-interest frequency spectrum) and a frequency spectrumcorresponding to the data encompassed by the region(s) of baselineactivity 540 (baseline frequency spectrum).

At block 830 in FIG. 8B, and after any preliminary calculations havebeen undertaken to determine whether to, for example, combineuser-selected regions of interest, the content of the region(s) ofinterest is evaluated to determine whether the signal in the region ofinterest can be characterized primarily by one of rhythmic activity,spiking activity, an increase in signal power, or some other featurethat may be of interest to the user. (In FIG. 8B, it is assumed thatAlgorithm 1 determines that the activity type is rhythmic activity.)

In one embodiment, determining that the activity type is rhythmicactivity may be accomplished by evaluating the power spectrum of thesignal and determining if there is at least one frequency which hassignificantly greater power than other frequencies. If the region(s) ofinterest is deemed to represent rhythmic activity, and the system'savailable options for detecting rhythmic activity include a half wavedetector, then the system may determine parameters for an instance of ahalf wave detector. Various aspects of an embodiment of an algorithm fordetermining a parameter set for a half wave tool for rhythmic activityare described with reference to the items within the block 855 of FIG.8B.

At block 840, a peak frequency is determined. In an embodiment, in asimple example where there is one region of interest and one region ofbaseline activity, the two frequency spectra (that is, theregion-of-interest frequency spectrum and the baseline frequencyspectrum) are compared to identify a frequency of interest. In someapplications, this frequency of interest is a frequency that is presentwith higher power within in the region of interest as compared to atbaseline.

It will be apparent that more than one approach may be used to obtain afrequency spectrum for a given region. In some embodiments, a frequencyspectrum may be obtained by using a fast Fourier transform or “FFT”. Inother embodiments, the frequency spectrum may be obtained using linearpredictive coding or “LPC.” Linear predictive coding may provide anadvantage over more traditional methods of estimating the power spectraldensity in a signal insofar as LPC may smooth the frequency peaks suchthat the number of frequency peaks in a sample may be more easilyperceived or specified.

Frequency spectra for the same sample electrographic signal (e.g.,corresponding to a user-selected region of interest 520) are shown inFIGS. 9A and 9B. In these two figures, the x-axis corresponds tofrequency in Hz, and the y-axis corresponds to relative power. FIG. 9Ais a frequency spectrum 900 obtained by using an FFT approach. FIG. 9Bis a frequency spectrum 902 obtained from the same signal by using anLPC approach. If the peak frequencies are deemed to occur at about 10 Hzand 26 Hz, then it can be appreciated by comparing FIG. 9B with FIG. 9Athat each of the first peak frequency 910 and the second peak frequency920 are easier to pick out in the LPC frequency spectrum 902 than theyare in the FFT frequency spectrum 900, at least for the reason that theLPC frequency spectrum 902 is much smoother than that of the FFTfrequency spectrum 900.

FIGS. 10A and 10B illustrate a comparison of a region of interest and aregion of baseline activity. In FIG. 10A, the x-axis corresponds tofrequency in Hz, and the y-axis corresponds to relative power. In FIG.10B, the x-axis corresponds to frequency in Hz, and the y-axiscorresponds to a ratio of relative power. In FIG. 10A, the frequencycontent a region of interest 520 is shown on the same graph with afrequency content of a first region of baseline activity 540 and afrequency content of a second region of baseline activity 540. Thedotted trace 1010 corresponds to the frequency content of the region ofinterest, the trace identified with crosses 1020 corresponds to thefrequency content of the first region of baseline activity (“firstbaseline”) and the triangle trace 1030 corresponds to the frequencycontent of a second region of baseline activity (“second baseline”).FIG. 10B represents a ratio of the region-of-interest frequency content1010 to the average baseline frequency content (average of 1020 and1030). In this particular example, a salient frequency may be defined asa frequency that is present in the region of interest 520 but that isnot present in either of the first or second regions of baselineactivity 540. Thus, in FIG. 10B, it easily can be appreciated that theratio of power of the region of interest relative to the baselineregions is greatest at about 10 Hz. Specifically, at about the point1080 on the trace 1060, there is about two times the power in the regionof interest than in the average of the first and second baselineregions. In this example then, the salient frequency 1080 isapproximately 10 Hz, and the system and method for automaticallyderiving a parameter set will use 10 Hz as the peak frequency.

It is predictable that a given region of interest 520 selected by a usermay be characterized by more than just one salient frequency after thefrequency content of the region of interest is analyzed according toembodiments, at least for the reason that the definition of whichfrequencies are “salient” may vary. The system and method forautomatically deriving a parameter set for a detector that depends on afrequency may be customized for different definitions of “salient.” Inreal world implementations of the system and method, the ability tocustomize the automatic derivation will translate to a user's being ableto fine tune the system and method for a particular patient without haveto fully appreciate how each individual parameter of the detectorrelates to how patterns (or other features) of the monitoredphysiological data are detected. For example, when more than one peakfrequency is identified in a user-selected region of interest, thesystem and method for automatically deriving a parameter set for a halfwave detector may choose only one of these frequencies to use as a peak.For example, a salient frequency may be selected as the higher of two orthe highest of three or more frequencies. Alternatively, and withreference to block 868 in FIG. 8B, the system may display the pluralityof peak (or other “salient”) frequencies to the user and prompt the userto select one of them for use in a system and method for automaticallyderiving a parameter set.

There may be circumstances in which a particular region of interest in asignal (or other sample of a form of physiological data other than anelectrographic signal), does not fit well with a particular detector.For example, if after obtaining frequency spectra for a user-selectedregion of interest and region(s) of background activity, no peak orpeaks in frequency are obvious, then a detector that does not require aninput related to frequency may be deemed more appropriate. For example,in the RNS SYSTEM described previously, the detection tools a user isable to choose from include a half wave detector, a line lengthdetector, and an area detector. If a system or method for automaticallyderiving a parameter set cannot find at least one peak frequency in aregion of interest (for example, via linear predictive coding or fastFourier transforms or otherwise), then the system or method maydetermine that it is more appropriate to use an automatic parametervalue derivation method for another type of activity or pattern such asspiking in block 860 or power change in block 846, which may include useof another detection tool, such as the line length tool or the areatool. In the case where an automatic derivation system or method cannotfind any detector that seems to fit the characteristics of a givenregion of interest selected by a user, at block 850, the system ormethod may resort to a default, which may comprise a particular kind oftool configured in a particular way, or the system or method maycommunicate to the user that it cannot find a good fit based on theregion(s) of interest the user has selected, or the system or method maydo both of these things.

It will be apparent that a variety of different methods may be appliedto facilitate the robustness and reliability of the set of values thatresults from the automatic derivation. For example, a method may beconfigured to evaluate segments of the electrographic signal just priorto and just after a user-selected region of interest. Evaluatingsegments just prior to and just after the user-selected region ofinterest could be advantageous if the user has not selected preciselythe region containing the signal of interest. Alternatively oradditionally, the method may be configured to divide a particular regionof interest into multiple pieces. Evaluating segments within a givenregion of interest could be advantageous if the signal within the regionof interest has more than one feature. For example, the first half of aregion of interest may have a feature corresponding to a peak frequencyaround 10 Hz, and the second half of the region of interest may havespiking activity. (See FIG. 22C for an example of a signal that exhibitsa peak frequency in one segment (first half) and spiking in anothersegment (second half)).

In the case where the analysis of the frequency content of a region ofinterest 520 (e.g., compared to one or more regions of backgroundactivity 540) reveals a salient frequency or where a salient frequencyis otherwise identified by the system (e.g., a frequency is selected asa salient one by the computer or a user), then values for three of theparameters of a half wave detector may be automatically derived asdescribed below.

For a given salient frequency, there is a set of possible values foreach of the half wave count criterion parameter 194 and the half wavewindow size parameter 195. Once the system and method for automaticallyderiving a parameter set for a half wave detector has selected a pair ofvalues for the half wave count criterion parameter 194 and the half wavewindow size parameter 195, the system and method can select (or a usercan be prompted to provide) a value for the minimum half wave width 193.This process is described in more detail below and with reference toblock 870 of FIG. 8B.

In a half wave detector such as the half wave detector described indetail above, the half wave count criterion parameter 194 and the halfwave window size parameter 195 are related to the minimum frequency thatthe half wave detector will be tuned to detect as follows:

${Frequency}_{\min} = \frac{\left( {{HalfWaveCountCriterion} - 1} \right) \times \frac{1}{2}}{HalfWaveWindowSize}$

When a salient frequency 1080 corresponds to the desired minimumfrequency for detection, the unknowns in the above equation become thevalues for the half wave count criterion parameter 194 and the half wavewindow size parameter 195. Automatically deriving parameter values for ahalf wave detector according to some embodiments involves sorting thepossible values for the half wave count criterion parameter 194 and thehalf wave window size parameter 195 (for a given salient frequency).

For a given salient frequency, there are a certain number of possiblepairs of values for the half wave count criterion parameter and halfwave window size parameter that correspond to that frequency. Referringnow to FIGS. 11A-11C, three ways of looking at the possible pairs ofvalues for these parameters are described. In each of FIGS. 11A-11C, they-axis corresponds to the number of pairs of the two parameters thatwill result in a given frequency or frequency bin (the y-axis in thefigures is labeled “Number of Count & HW Window Combinations”). Thex-axis corresponds to the frequency or frequency bin (in Hz) to whicheach number of pairs corresponds.

In FIG. 11A, the x-axis corresponds to unique frequencies (e.g., 9.7 Hz,10.2 Hz, 11.3 Hz etc.). In FIG. 11B, the x-axis corresponds to integerfrequencies only (e.g., 9 Hz, 10 Hz, 11 Hz). In FIG. 11C, the x-axiscorresponds to an organization of the possible frequencies based on howmany pairs of the half wave count criterion and half wave window sizeare associated with each frequency range (in FIG. 11C, the x-axis islabeled “Binned Frequencies”). Put another way, FIGS. 11A-11C correspondto histograms where each ‘bin’ associated with a given frequencyrepresents the number of pairs of possible values for the half wavecount criterion and half wave window size for a given frequency range.

With particular reference to FIG. 11A, it can be appreciated that somefrequencies, especially in the lower range of the frequencies shown inFIGS. 11A-11C, have over 16 possible pairs of values. Other frequencies,particularly in the higher range of the frequencies shown in FIGS.11A-11C, have only one or two possible pairs of values. For example, inthe bin 1102 at about 8 Hz and in the bin 1104 at about 10.5 Hz in FIG.11A, it appears that there are sixteen possible pairs for the half wavecount criterion/half wave window size combination. At about 80 Hz in thebin 1106 and at about 90 Hz in the bin 1108, it appears that there areonly two pairs or one pair, respectively.

In FIG. 11B, the histograms are binned in integer values rather thanactual values of a given half wave count criterion/half wave window sizecombination. For example, if the frequency is 8.2 Hz the half wave countcriterion/half wave window size combination would be contained withinthe 8 Hz bin. As might be expected, the number of possible pairs foreach integer value goes up at the lower frequencies and is lower at thehigher frequencies. For example, there appear to be about 248 pairs ofpossible values for the half wave count criterion and the half wavewindow size in the bin 1120 at about 4 Hz and about 110 pairs in the bin1122 at about 8 Hz; whereas there appear to be less than ten pairs ineach of the bin 1126 at about 48 Hz and the bin 1128 at about 90 Hz.

A more optimal binning of the possible values of the parameter pairsversus frequency may be accomplished by defining a bin according to atotal number of pairs. For example, in FIG. 11C, each bin is defined asnominally including sixteen pairs. (A given bin may have a few more orless pairs than sixteen pairs for a given frequency: for example, ifthere were three pairs of values for the half wave count criterionparameter 194 and the half wave window size parameter 195 thatcorresponded to a frequency of 12.3 Hz, and fifteen pairs for the halfwave count criterion parameter and half wave window size parameter thatcorresponded to a frequency of 12.5 Hz, then the bin that includes thesetwo frequencies would have a total of eighteen pairs rather than thenominal value of sixteen pairs). In the binning method reflected in FIG.11C, each bin will correspond to a similar number of pairs. Thefrequency range for each bin will be associated with a range that coversthe lowest frequency yielded by a pair in the bin to the highestfrequency yielded by a pair in the bin.

Within each bin of FIG. 11C, the pairs may be organized according to thevalues for the half wave count criterion 194 (i.e., from lowest tohighest) and then by the minimum frequency of detection a pair wouldyield (i.e., from the lowest to the highest frequency). A reasonableassumption might be made that, with all else being equal, a detectorthat requires fewer counts in order to decide whether something shouldbe detected is more sensitive than a detector that needs more countsbefore triggering a “detection.” With that assumption, the possiblevalues for the half wave count criterion parameter 194 and the half wavewindow size parameter 195 in each bin are essentially ordered from mostsensitive to least sensitive. Once the pairs are ordered in this way,when a user instructs the system to adjust the sensitivity of therelevant half wave detector (for example, by sliding an indicator in aslider 670), the system and method for automatically deriving aparameter set for that half wave detector can react to the user'scommand by effectively moving around (e.g., up or down) within a bin inorder to try out or choose new pairs of values for the half wave countcriterion 194 and the half wave window size 195 (this sensitivityadjustment may be presented to a user in the form of a “lessspecific/more specific” option as was described with reference to FIG.6.

For a given salient frequency, according to embodiments, the system andmethod for automatically deriving a parameter set will select the binwhich most closely matches the salient frequency (e.g., if a bin coversa frequency range from 12.3 to 12.5 Hz and the salient frequency is 12.5Hz, then the algorithm will select that bin). The algorithm may select asingle one of the pairs of values for the half wave count criterionparameter and the half wave window size such as single pair in about themiddle of the bin. If when a simulation corresponding to a test run ofthe algorithm is ultimately displayed to the user, the user decides thehalf wave detector is not configured to detect what the user wants, thenby adjusting the sensitivity slider 640 to be more or less specific, theuser can try out any of the rest of the pairs of values in that samebin. Alternatively, which pair of values the algorithm initially chooseswithin a particular bin may be dictated by another automatic computationor computations. In still other embodiments, choices of parameter valuepairs after an initial parameter value pair has been selected and testedmay be accomplished using automatic computation(s). Importantly, andalthough what the system and method is doing in the parameter space maynot be at all intuitive to the user, the user nonetheless willappreciate that he can expect the behavior of the system to adjustitself in one direction or the other based on his sensitivityadjustments.

Once the system and method for automatically determining a parameter setfor the half wave detector has identified the minimum frequency fordetection using the salient frequency 1080 by selecting a half wavecount criterion 194/half wave window size 195 pair of values, it candetermine a value for the minimum half wave width parameter 193. Theminimum half wave width corresponds inversely with a maximum half wavefrequency HWfreq_(max). In some embodiments, a requirement can apply,for example, that the maximum half wave frequency HWfreq_(max) be Ntimes larger than the minimum half wave frequency with the Nyquistfrequency, which is the sampling rate divided by 2, as the maximumpossible value. In some real-world examples of sets of values for theparameters of a half wave detector in the RNS SYSTEM, the value for theminimum half wave width may be either 0 ms or 4 ms These valuescorrespond to a maximum half wave frequency of 125 Hz or 62.5 Hz,respectively. This experience suggests that a value of N between 5 and10 may be appropriate in many cases.

Although in this example the system and method for automaticallyderiving a parameter set for a half wave detector has been described asdetermining the values for the relevant parameters in a particularsequence, it will be appreciated that this sequence may be different,for example, depending on what a detector is intended to detect. Forexample, in an embodiment where a half wave detector is being configuredto detect a pattern of rhythmic activity in a monitored electrographicsignal, then the system and method for automatically deriving aparameter set for a half wave detector may begin by selecting a valuefor a half wave count criterion parameter. However, in an embodimentwhere a half wave detector is being configured to detect the occurrenceof spikes in a monitored electrographic signal, then the system andmethod for automatically deriving a parameter set for a half wavedetector may begin by selecting a value for a half wave hysteresisparameter. Thus, it will be appreciated that the parameters relevant toa given detector may be automatically derived in different sequencesdepending on, for example, the nature and type of activity the detectoris intended to detect. Alternatively or additionally, other computationsmay be used by the algorithm in between the operations for determiningvalues for the parameters detailed herein. For example, a computation todetermine a value for some additional parameter may be inserted betweenan operation for determining whether a region of interest exhibits asalient frequency and an operation for determining the values for a halfwave count criterion parameter/half wave window size parameter pair.

After the user has selected at least one region of interest 520 and thesystem and method for automatically deriving a parameter set for a halfwave detector has identified values that ultimately correspond to aminimum frequency for detection and a maximum frequency, the system andmethod may determine a value for the half wave hysteresis parameter 191.

In some embodiments, and when the physiological data is anelectrographic signal, the value assigned to the half wave hysteresisparameter 191 may correspond to a minimum amplitude that a given halfwave (e.g., a transition in the waveform from a positive slope to anegative slope) must meet or exceed before the transition will bedefined as a half wave. Referring again to FIGS. 1 and 2, it generallywill not be desirable to define every transition in the signal as a halfwave. Rather, it may be desirable to discount as mere “perturbations”those transitions that never exceed a certain threshold. In the exampleof FIG. 1B, each of the half wave #2 120 and the half wave #3 130 weredeemed to be mere perturbations and therefore were both accounted for byincluding them as part of the first half wave 202 of FIG. 2. Similarly,the half wave #5 150 and the half wave #6 160 of FIG. 1B were eachdeemed to be mere perturbations and therefore were ignored in definingthe second half wave 208 in FIG. 2. Since the hysteresis parameter valueis in amplitude units according to some embodiments, a particular halfwave that only lasts a short time may still be deemed to comprise a halfwave if the amplitude threshold is met or exceeded (see, e.g., the sixthhalf wave 320 of FIG. 3).

Generally, the value of the half wave hysteresis parameter 191 is usedby the detection algorithm to allow a half wave detector to ignore smallperturbations (which might be attributable to, for example, noise), in afunction similar to that of a low pass filter.

In a system and method for automatically deriving a parameter set for ahalf wave detector according to embodiments, the possible values for thehalf wave hysteresis parameter 191 may range from 0 to 255 (amplitudeunits). The system and method may test each of these possible values andthen select one for the half wave hysteresis parameter 191 thatcorresponds to some minimum amplitude that has to be met or exceededbefore a transition may be counted as a half wave. For example, all ofthe possible hysteresis values from 0 to 255 may be tested for a givenregion of interest 520 to determine what percentage of the total numberof transitions identified in that sample are identified as half waves.If the value for the half wave hysteresis parameter 191 is set to anon-zero value, this value will reduce the number of half waves that areidentified in the sample.

Once the system and method for automatically deriving a parameter setfor a half wave detector has determined the percentage of half wavesthat exceed the minimum half wave width 193 for each value of the halfwave hysteresis parameter 191, the system and method can select one ofthose hysteresis values to use. For example, a value for the half wavehysteresis parameter 191 may be selected so as to maximize thepercentage of half waves that exceed the minimum half wave width 193while minimizing the hysteresis parameter value 191.

Referring now to FIG. 13, in an embodiment, a value for the half wavehysteresis parameter 191 may be selected by identifying the minimumhysteresis parameter value that maximizes the percentage of half wavesthat exceed a minimum half wave width 193. In FIG. 13, the y-axisrepresents the percentage of half waves in a sample that exceed aminimum duration (time) criterion for a given value of the half wavehysteresis parameter 191 on the x-axis. The dotted line 1310 in FIG. 13shows which values of the possible values for the half wave hysteresisparameter 191 correspond to the highest percentage of half waves in thesample. In this example, it appears for a hysteresis value just higherthan 30, the percentage of half waves with a duration meeting theminimum duration criterion reaches a maximum and thereafter levels off.

The dashed line 1330 represents the distance of the dotted line 1310from the point (0,1) on the graph of FIG. 13. The system can beconfigured to choose a value for the half wave hysteresis parameter 191that minimizes the distance from the point (0,1) by modeling thedistance 1330 by a fourth order polynomial. The result of this modelingis represented by the line drawn with triangles 1340 in FIG. 13. Thevalue selected for the hysteresis parameter 191 can be chosen as theminimum value 1350 on the triangle-line 1340, which appears as though itoccurs at about a value of 20.

In some embodiments, the system and method for automatically derivingparameter values for a half wave detector may determine a value for theminimum half wave amplitude parameter 192 using a value for the halfwave hysteresis parameter value 191, for example, the hysteresisparameter value selected according to the process described above. Givena selected value for the hysteresis parameter 191, the number of halfwaves occurring (i.e., the “half wave counts”) in a region of interestand in a region or regions of baseline activity may be determined. Oncethe number of half waves is determined, the half waves can be sorted(e.g., into bins in a histogram) according to amplitude or ranges ofamplitude. The number of half waves in each bin can be normalized bydividing the sum in a bin by total number of half waves counted in therelevant sample (e.g., in a sample corresponding to the region ofinterest or in a sample corresponding to the region(s) of baselineactivity).

The results of this process of sorting the number of half waves in eachbin for the region of interest and the region(s) of baseline activitymay used to identify an amplitude for which the percentage of half wavesin the region of interest (e.g., the normalized half wave counts for theregion of interest) is greater than the percentage of half wave countsin the baseline region(s). In this way, the system can determine astarting parameter value for the minimum half wave amplitude parameter.The half wave amplitude parameter can subsequently be adjusted by theuser using a sensitivity adjustment such as a signal amplitude slider640. An advantage of normalizing the half wave count in each bin by thetotal number of half waves in the sample is that the calculation is thenindependent of the sample size. For example, if the baseline region weretwice as long as the region of interest, the normalized half wave countscould still be compared between the regions.

Referring now to FIG. 14, four plots are shown which illustrate themethod of identifying a point where the normalized half wave counts in aregion of interest begins to be greater than the normalized half wavecounts in the baseline region(s). In this figure, the x-axis representsbins of amplitude and the y-axis represents the percentage of half wavecounts within each amplitude bin. The dotted line 1410 is the normalizedhalf wave counts for the baseline region(s), and the plot shown with thetriangles 1430 is the normalized half wave counts for the region ofinterest. The plots may be modeled using for example a fourth orderpolynomial in order to smooth the data to better identify the point atwhich there is a higher percentage of half wave counts in the region ofinterest relative to the baseline region. The dashed line 1420 and theplot with squares 1440 are the fourth order polynomials of the dottedline 1410 and the plot with triangles 1430, respectively.

In FIG. 14, at about the point 1450 corresponding to about 70 amplitudeunits, it can be appreciated that the percent of half wave counts in theregion of interest 520 begins to be greater than the percent of halfwave counts in the region(s) of baseline activity 540. Thus, in thisexample, the system and method for automatically deriving a set ofparameters for a half wave detector may select a value of around 70(amplitude units) as an initial value for the half wave minimumamplitude parameter 192. In some embodiments, this starting parametervalue can subsequently be adjusted with feedback from the user, such asby using a “signal amplitude” slider 640 to detect less or detect more.

The foregoing example of a system and method for automatically derivinga parameter set for a half wave detector describes how values for fiveof the parameters used in a half wave detector may be automaticallyestablished based on a region of interest selected by a user and one ormore regions of baseline activity selected by a user or a computer. Theparameters for which at least a starting value is selected are the (1)half wave count criterion parameter 194: (2) the half wave window sizeparameter 195; (3) the minimum half wave width parameter 193; (4) thehalf wave hysteresis parameter 191; and (5) the minimum half waveamplitude parameter 192. In the particular half wave detector describedwith reference to FIG. 1, the other parameters include the qualifiedanalysis window count parameter 196 and the detection analysis windowsize parameter 197 (for establishing an “X of Y criterion fordetection). In some implementations of a half wave tool, these twoparameters are also sometimes referred to as the “bandpass threshold”and the “detection analysis window size”, respectively.

The qualified analysis window count parameter 196 and the detectionanalysis window size parameter 197 work together in the half wavedetector to specify a duration and consistency for a pattern of activitythat is represented in the electrographic signal that will trigger thetool to ‘detect’. For example, a value of 8 for the qualified analysiswindow count parameter 196 and a value of 2048 ms for the detectionanalysis window size parameter 197 translate into a requirement thathalf waves meeting the criteria established by the five parametersdiscussed above would have to occur in at least 8 128 ms windows within2048 ms. A system and method for automatically deriving a parameter setfor a half wave detector may select starting values for the qualifiedanalysis window count parameter 196 and the detection analysis windowsize parameter 197 such that when using the set of detection parametersidentified by the algorithm, detection would occur in the region ofinterest. In other words, simulations can be run with the startingvalues for the half wave count criterion parameter 194, the half wavewindow size parameter 195, the minimum half wave width parameter 193,the half wave hysteresis parameter 191, and the minimum half waveamplitude parameter 192, and various combinations of the qualifiedanalysis window count parameter 196 and the detection analysis windowsize parameter 197 to determine the largest qualified analysis windowcount parameter 196 value which would result in detection in theselected region of interest.

Spike Activity/Half Wave Detector

Referring now to FIG. 8C, embodiments will be described of a system andmethod for automatically deriving a parameter set for a half wavedetector where the physiological data at issue compriseselectrocorticographic signals and the type of activity in the region(s)of interest has been determined to be (for example, by an activity typealgorithm such as Algorithm A in FIG. 8A) spiking. Generally, spikingactivity in physiological signals (e.g., EEG, ECG, EMG, etc.) may be ofclinical significance in many disorders or conditions. Spiking activityin ECOGs may be considered a hallmark of epileptiform activity inepilepsy.

Spiking activity may be characterized by a basic structure associatedwith each spike that may be referred to as a “spike complex” or “SC”. Ahalf wave detector can be configured to look for spiking with similarparameters as a half wave detector for detecting rhythmic activity. Forexample, in a given region of interest, a spike complex may be definedas the occurrence of two consecutive half waves with opposite slopes(e.g., a positive slope followed by a negative slope), each of whichexhibits a higher amplitude than the amplitude of some or most of theother half waves with which the region of interest may be characterized.Some examples of regions containing spiking activity and characterizableby at least one spike complex are shown in FIGS. 12A-12E where thex-axis is in units of time and the y-axis is in units of amplitude.

In FIG. 12A, a portion 1202 of an ECOG signal is shown with a spikecomplex 1210 comprised of three half waves, a first SC half wave 1212characterized by a negative slope, a second SC half wave 1214characterized by a positive slope, and a third SC half wave 1216characterized by a negative slope. It is apparent that the three SC halfwaves 1212, 1214, and 1216 stand out from the other transitions or halfwaves in the portion 1202 because each of the SC half waves 1212, 1214,and 1216 have greater amplitude than the other transitions or halfwaves.

In FIG. 12B, a portion 1220 of an ECOG signal is shown with a spikecomplex 1222 that is comprised of only two half waves that stand outfrom the rest, namely, a first SC half wave 1224 with a positive slopeand a second SC half wave 1226 with a negative slope. And in FIG. 12C, aportion 1228 of an ECOG signal is shown with a spike complex 1230 thatis also comprised of only two half waves, but in this case the spikecomplex begins with a first half wave 1232 characterized by a negativeslope and ends with a second half wave 1234 characterized by an positiveslope.

In FIG. 12D, each of the spike complexes 1240 shown in the signalportion 1238 are composed of a set of six half waves that are easilydiscernible from other activity in the signal portion. In FIG. 12E, eachof the spike complexes 1250 in the signal portion 1248 is characterizedby three SC half waves.

It should be appreciated that, for a given user-selected region ofinterest in which spike complexes occur, a system and method forautomatically deriving a parameter set for a spike detector may sort thespike complexes using one or more features, such as the number of halfwaves in a spike complex, the amplitude of the half waves that comprisea spike complex, the duration of a spike complex or the duration of eachhalf wave that makes up a given spike complex, and so on and so forth.

In one embodiment, and with reference now to FIG. 8C, once a user hasselected a region or regions of interest (and, optionally, either theuser or the computer has selected one or more regions of baselineactivity), and at block 830 an activity type algorithm has selected“spiking”, then a system and method for automatically deriving aparameter set for a half wave detector configured to look for spikes isinvoked at block 860.

The first half wave detector parameter with which the automaticderivation is concerned may be the half wave hysteresis parameter 191.In light of the discussion of this parameter in connection with thedescription of a half wave detector configured to look for rhythmicactivity, it should be appreciated that the half wave hysteresisparameter 191 can be used to disregard half waves in a region ofinterest that have an amplitude less than the smallest amplitude halfwave within a spike complex. Establishing a value for the hysteresisparameter 191 at the outset thus allows the algorithm to eliminate halfwaves that are too small to be considered part of any spike complex inthe region(s) of interest, including but not limited to half wavesassociated with noise in the signal.

For detecting spiking, a goal for a half wave detector would be todetect the spike complexes that occur in the region(s) of interest. Iftoo high a value for the hysteresis parameter 191 is selected by theautomatic derivation system and method, then some half waves that form apart of a spike complex may be excluded by the spike detector. On theother hand, if too low a value for the half wave hysteresis parameter191 is selected, then too many half waves are likely to be included suchthat the spike complexes may not be easily discerned from interspikeactivity including but not limited to signal noise. Accordingly, a valuefor the half wave hysteresis parameter 191 may correspond to a targetthat represents a compromise between over-inclusion or under-inclusionof half waves in a given instance of a spike detector. Moreparticularly, such a target may aim to have a high enough number of halfwaves detected to completely include all of the half waves that make upa spike complex but to not include so many half waves that the spikecomplexes are obscured.

More particularly, and with reference now to FIG. 18 and to block 861 ofFIG. 8C, in an embodiment, a value for the half wave hysteresisparameter 191 may be selected as described below. First, a total numberof half waves in the region(s) of interest are counted (based on somepredefined sampling rate). Then, the system and method calculates howmany of the half waves in that total would remain for each possiblevalue of the hysteresis parameter 191. An objective would be to choose avalue for the hysteresis parameter that would include all of the halfwaves in the spike complex(es) but that is not so low or so high a valuethat too many or too few half waves are included.

An example in which a value of about 50 for a half wave hysteresisparameter 191 ultimately is selected by a system and method forautomatically deriving a parameter set for a half wave detectorconfigured to look for spiking activity will now be described withreference to FIG. 18. In the plot 1800 of FIG. 18, the x-axis representsthe possible values for the hysteresis parameter in units of amplitude(i.e., at a hysteresis value of 75, half waves with an amplitude of lessthan 75 amplitude units will be excluded by the half wave detectionalgorithm). The y-axis represents the number of half waves that will becounted in a given user-selected region(s) of interest for a given valueof the hysteresis parameter. For example, if the value for the half wavehysteresis parameter 191 is set at 25, about 115 half waves in theregion(s) of interest will be recognized by the half wave detectionalgorithm.

Generally, it can be appreciated from the shape of the solid line 1810in FIG. 18 that the half wave count in a region or regions of interestversus the possible hysteresis parameter values may be modeled as anexponential decay. In this particular example, a 5-point moving averagewas used to smooth the curve. The excursion of the line 1810 shows thatthe half waves that would be counted by the detection algorithm in asignal that has half wave content similar to that in the region(s) ofinterest may vary widely for very low values for the hysteresisparameter 191 (e.g., for values of the hysteresis parameter below about20, somewhere between 140 and 225 half waves in a portion of a sensedsignal corresponding to the region(s) of interest would be recognized bythe detection tool). And for values of the hysteresis parameter 191above about 110 units, the half waves that would be counted may be about25 or less. In the example shown in FIG. 18, hysteresis parameter valuesbetween about 25 and 75 are likely to yield the most repeatable andconsistent count of half waves.

In order to narrow the hysteresis parameter down to one value, a methodfor automatically deriving a parameter set for a spiking activitydetector may select a value that seems to represent the best compromisebetween over- and under-inclusion of half waves. Determining such avalue may be accomplished, for example, by measuring a Euclideandistance-to-origin for the curve 1810. The Euclidean distance-to-origincorresponding to the points on the curve 1810 is represented by thedashed line 1812 in FIG. 18. The lowest point on the curve 1812corresponds to the shortest or minimum distance to the origin (i.e., thepoint 0,0 on the plot 1800 of FIG. 18). The lowest point on the curve1812 also corresponds to a hysteresis value of about 50. In thisparticular example, then, a system and method for automatically derivinga parameter set for a spiking activity detector may select 50 as thevalue for the hysteresis parameter 191.

In some embodiments, the system and method may select a value for thehysteresis parameter 191 based on data in the region of interest for asingle patient. In other embodiments, the data on which selection of avalue for the hysteresis parameter 191 is based may include data fromone or more user-selected regions of interest for a particular patientas well as data from other patients (such as from other patients with ademographic element in common with the patient associated with theuser-selected region(s) of interest). In such cases, it may be useful tonormalize the x and y axes to the maximum values before calculating theEuclidean distance to the origin.

With reference now to block 862 of FIG. 8C and FIG. 19, after a systemand method for automatically deriving a parameter set for a half wavetool configured as a spike detector has selected a value for thehysteresis parameter 191 based on the user-selected region(s) ofinterest, the half waves that are not excluded by the hysteresis limitare sorted based on amplitude, for example, from smallest to highestamplitude. When a region of interest comprises spike activity, the halfwave amplitudes initially tend to grow slowly and then more rapidly forhigher amplitudes, such that the half wave rate of growth (slope) in aregion of interest containing spike complexes usually starts slow andends up high. In other words, when the half waves are ordered byamplitude, if there are spike complexes in the signal, there is often anabrupt transition between the low amplitude half waves (which are notassociated with the spikes) and the high amplitude half waves (which areassociated with spikes). Such a rate of growth is illustrated in FIG.19. The y-axis corresponds to the half wave amplitude (in FIG. 19, thehalf wave amplitude values are normalized so that the maximum possibleamplitude correspond to “1” and the minimum possible amplitude is closeto “0”). The x-axis corresponds to the half wave index when sorted byhalf waves and normalized so that the maximum possible value is “1” andthe smallest possible value is close to “0”). The dotted line 1910represents the sorted amplitudes corresponding to the half waves thatremain in the region(s) of interest after some half waves have beeneliminated based on an applied hysteresis (i.e., where the hysteresisparameter has a non-zero value). The sorted amplitudes start outrelatively low and trend higher. The dashed line 1912 represents thedistance from a point on the curve 1910 to a point at about (1, 0.25)and the triangle line 1914 represents a minimum distance from the point(1, 0.25). An intermediate slope (rate of growth) occurs around thepoint closer to the corner point (1,0).

In an embodiment of a system and method for automatically deriving aparameter set for a spike detector, a value for a minimum half waveamplitude 192 is selected which corresponds to a point on FIG. 19corresponding to an amplitude closest to the point (1, percent), where“percent” is a selectable parameter for. In an embodiment, a defaultvalue for the percent parameter may be 25%. Thus, in the sortedamplitudes curve 1910, that amplitude which minimizes the distance tothe point (1, 0.25) is selected by the system and method as theamplitude threshold, i.e., the value for the minimum half wave amplitudeparameter 192.

In another embodiment, a system and method for automatically deriving aparameter set for a spike detector may start out with a value for theminimum half wave amplitude parameter 191 that corresponds to anamplitude closest to the right bottom corner of the graph of FIG. 19,i.e., to the amplitude close to the point (1,0), although this selectionmay prove to make the detector too sensitive and therefore may requiresome further adjustment after a simulation or test run on some samplesignals to make it less sensitive. The adjustment may be accomplished bya user over a graphical user interface (GUI) using one or more sliderssuch as described with reference to FIG. 6, above.

Referring now to block 863 of FIG. 8C, the next step for a system andmethod for automatically determining a parameter set for a spikedetector may be to find a value for the minimum half wave widthparameter 193 based on the user-selected region(s) of interest. Once theautomatic deriving method has arrived at a value for the minimum halfwave amplitude parameter 191, then the method can use that value toclassify each remaining half wave (i.e., each half wave that surviveshysteresis and meets or exceed the minimum amplitude requirement) aseither “spike” or “non-spike.” More particularly, if a half wave has anamplitude that is greater than or equal to the minimum half waveamplitude, then that half wave will be classified as a “spike” half wave(e.g., as part of a spike complex) and if a half wave has an amplitudethat is less than the minimum half wave amplitude, then that half wavewill be classified as a “non-spike” half wave. A lower bound for theminimum half wave width parameter 193 is initially determined byidentifying the half wave in the group of “spike” half waves that hasthe shortest duration. After the automatic deriving method hasaccomplished this, then it is important to assess whether there isoverlap between the durations of the half waves in the “spike” class andthe durations of the half waves in the “non-spike” class. This can beeasily accomplished by comparing the half wave in the “spike” classhaving the shortest duration (where “D1” is that duration) to the halfwave in the “non-spike” class having the longest duration (where “D2” isthat duration). If there is no overlap of minimum half wave width valuesbetween these two classes, then the half wave in the “non-spike” classwith the longest duration becomes the new lower bound for the minimumhalf wave width parameter. The minimum half wave width then is definedas the value from the discrete parameter space that is greater than andclosest to the shortest “spike” half wave minus 10% of the difference(D1−D2), i.e., D1−0.1 (D1−D2). If there is overlap of the minimum halfwave width values for the two classes (i.e., spike and non-spike halfwaves), then the lower bound is set as D1 and the minimum half wave ischosen to be the minimum half wave width value closest and greater thanD1.

With reference now to block 864 of FIG. 8C, an embodiment of a systemand method for automatically deriving a parameter set for a half wavedetector configured to look for spikes will find a value for the halfwave window size parameter 195 and the half wave count criterion 194.Using the class assignments for the half wave amplitudes (i.e., “spike”or “non-spike”), the spike complexes are identified by searching for atleast two of more consecutive spike-class half waves through the regionor regions of interest. An average frequency of the spike complexes canbe assessed as:

$\begin{matrix}{{{Avg}\mspace{14mu} {Frequency}\mspace{14mu} {of}\mspace{14mu} {SCs}} = \frac{{Total}\mspace{14mu} {number}\mspace{14mu} {of}\mspace{14mu} {SCs}}{{Total}\mspace{14mu} {time}\mspace{14mu} {duration}\mspace{14mu} {of}\mspace{14mu} {the}\mspace{14mu} {ROI}}} & (1)\end{matrix}$

-   -   where “SC” means “spike complex” and “ROI” means “region of        interest.” The duration of each spike complex in a region of        interest is determined by the sum of the durations of        consecutive spike half waves. A conservative half wave window        size is defined as the sum of the longest spike complex, and the        average spike complex period is assessed as the inverse of        equation (1).

The half wave count criterion 194 is determined as the average number ofhalf waves per spike complex pattern, which is assessed as:

$\begin{matrix}{{count} = {\frac{1}{N}{\sum\limits_{i = 1}^{N}\; {{numHW}(i)}}}} & (2)\end{matrix}$

-   -   where:        -   numHW(i)=the total number of spike-half waves that form the            ith spike complex        -   N=total number of spike complexes in the region(s) of            interest        -   i=index varying from 1 to N

In an embodiment, the value for the detection analysis window sizeparameter 197 may be fixed at 2048 ms. It will be appreciated that thevalue of the detection analysis window size parameter 197 may bemodified using faster detection as an objective/guiding criterion. Thequalified analysis window count 196 may be selected as the maximumbetween 1 and the average spike complex frequency. In an embodiment, thevalue of the detection analysis window size parameter 197 is determinedto be twice the value of the qualified analysis window count 196,provided that the resulting value is available in the parameter space.(In other words, if twice the value of the qualified analysis windowcount is a possible value in the range of values available for thedetection analysis window size, then the detection analysis window sizewill be set at twice the value of the qualified analysis window count.)

Activity Corresponding to a Power Change/Line Length Detector

Referring now to FIG. 8A, at block 846, the algorithm for determining anactivity type (“Algorithm 1”) has determined that the activity type inthe user-selected region(s) of interest corresponds to a change in thepower of the signal in the region(s) of interest as compared to thepower that otherwise characterizes the signal. In an embodiment, whenAlgorithm 1 determines that a “power change” detection tool is suggestedby a user's selection of a region or regions of interest, the detectiontool is a line length detector. Generally, a line length detectorestablishes a window of time in which to operate and then divides aportion of a signal occurring in that window (e.g., within in a timeperiod corresponding to a user-selected region of interest) into a setof samples where each sample has the same unit size, and then adds upall of the line lengths in the time window. The accumulated line lengthsfor the samples in the time window are then typically compared to atrend of line lengths relevant to the same signal in which the region ofinterest occurred, such as a trend of line lengths over a term that islonger than the time window. The trend to which the line length totalfor a given time window is compared may be a relatively short-term trendor a relatively long-term trend. Again, generally, if the line length inthe time window increases relative to the trend, then it may be inferredthat the power of the signal is changing so that there is more power inthe signal corresponding to the time window than there has been based onthe trend. Alternatively, if the line length in the time windowdecreases relative to the trend, then it may be inferred that a powerchange in the other direction is occurring.

A user may want to configure a line length detector to detect when thepower of a signal increases (or decreases) based on the supposition thatthe power change may be associated with a physiological change, such asthe onset of epileptiform activity. Some configurations for a linelength detection tool are described in U.S. Pat. No. 6,810,285 to Plesset al. for “Seizure Sensing and Detection Using an Implantable Device”issued Oct. 26, 2004. U.S. Pat. No. 6,810,285 is hereby incorporated inthe entirety by reference. The '285 patent describes implementing linelength detectors as instances of a “window analysis unit” in an activeimplantable medical device configured to detect events in signals sensedfrom a patient with epilepsy.

In an embodiment, a system and method for automatically deriving aparameter set for a power change detection tool configured as a linelength detection may only require input from a user to mark the start ofa region of interest in a portion of a signal (e.g., in a portion of apreviously-recorded ECOG for a patient). The system and method can usethe marked start of the region of interest to automatically determineparameters and values for the same that are biased to detect the same ora more pronounced change in the power of the signal being sensed fromthe patient (most commonly, an increase in signal power (or frequency)compared to a trend).

In an embodiment, and referring now to FIG. 24, a line length detectiontool is associated with a set of eight parameters the values of whichshould be set in order for the detection algorithm to operate optimally,and a system and method for automatically deriving a parameter set forthis tool derives values for the following: a short term window sizeparameter 2410, a long term window size parameter 2412, a detectionthreshold parameter 2414, a sample count parameter 2416, an inter-sampleinterval parameter 2418, a threshold logic parameter 2420, a thresholdmode parameter 2422, and a persistence parameter 2424. These eightparameters may be thought of as being in the “parameter space” for aline length detector.

Long Term Window Size Parameter; Sample Count Parameter; Inter-SampleInterval Parameter; Threshold Logic Parameter; and Persistence Parameter

Based on experience with active implantable medical devices configuredwith line length detectors used in responsive neurostimulators used as apart of a therapy for epilepsy, some commonly used values for some ofthe line length detector operation parameters are as follows: 4096 msfor each of the inter-sample interval parameter 2418 and the long termwindow size parameter 2412; 1 s for the persistence parameter 2424; a“non-inverted” setting for the threshold logic parameter 2420; a“percentage” value setting for the threshold mode parameter 2422 (versusfor example, a “fixed” value); and a value of 32 for the sample countparameter 2416. When experience such as this is at hand, then a systemand method for automatically deriving a parameter set for a line lengthdetector may benefit from initially establishing the parameter values atthese values. If after the simulation, a user is not satisfied with theresults, the system and method can begin again with different values forthe parameters for the tool. Alternatively, the user may be providedwith various options for adjusting the sensitivity of various aspects ofdetection by varying a given parameter within some bounds around theinitial value.

Short Term Window Size Parameter

Again, based on experience with active implantable medical devicesconfigured with line length detectors used in responsiveneurostimulators used as a part of a therapy for epilepsy, some commonlyused values for the short-term window size parameter 2410 are: 2048 ms;4096 ms, and 1024 ms. In some embodiments, an automatic parameterderiving system and method may be configured to start out with one ofthese values or with a different value for the short term window sizeparameter 2410 if, for example, the application is other than epilepsyor the user's experience with a particular patient or set of patients isdifferent. The short term window size parameter 2410 is also used tocontrol the latency of the detector (e.g. to detect a change in signalearlier or later). Subsequent to establishing an initial value for theshort term window size parameter 2410, and after the user has beenpresented with the result of the automatic parameter derivation method(e.g., via a simulation), the user may be provided a “user-friendly”feature on a display or other user/computer interactive interface, suchas by dragging an indicator to the right or to the left within a windowof a slider labeled to suggest in ‘plain English’ something thatcorresponds to adjusting the value of the short term window parameter2410 (e.g., a slider may be labeled “latency” and have a left-facingarrow at one end of the slider window labeled “detect sooner” and aright-facing arrow at the other end of the slider window labeled “detectlater”. In other words, by moving an indicator around within a sliderwindow, a user may adjust the latency by varying the short term windowsize parameter 2410. To achieve earlier detections, the short termwindow size parameter may be decreased within the parameter space ofvalues available. To increase the latency and detect later, the shortterm window size parameter may be increased.

Percentage Threshold Parameter

Since the threshold mode parameter 2422 is configured to correspond to apercentage, it is the main parameter that controls the detection in theregion of interest in at least this embodiment of a line lengthdetector. The system and method for automatically determining aparameter set for the line length detector will use the short termwindow parameter 2410 so that the short term window is positioned tostart at the first sample of the region of interest and to end so thatthe last sample of the long term window is the sample just before theregion of interest.

When the line length detection algorithm runs, line length values arecomputed for each of the short term window and the long term windowaccording to:

$\begin{matrix}{{{Line}\mspace{14mu} {length}\mspace{14mu} {measure}} = {\frac{1}{L}{\sum\limits_{i = 1}^{L - 1}\; {{{y(i)} - {y\left( {i - 1} \right)}}}}}} & (1)\end{matrix}$

Expression (1) corresponds to the line length measure for a window ofsize L, where the unit for L is the number of samples in the window. Asdefined in (2) the percentage threshold is given by:

Percentage threshold=threshold+Line length measure in long-termwindow  (2)

The maximum threshold available in the parameter space that satisfiesthe condition in (3) is determined to be the most appropriate thresholdto detect the same signal characteristics as are present representingthe power change in the region(s) of interest.

Line length measure in short-term window>Percentage threshold  (3)

In some embodiments, the user may be provided with an optionalsensitivity adjustment, which can be in the form of slider such as thesliders described above with reference to this line length detector andto the half wave detection tools for detecting rhythmic activity andspiking activity. For example, moving an indicator around within aslider window may have the effect of varying the percentage threshold toeither increase or decrease the sensitivity of the detection. Thisallows the user to refine the threshold parameter initially determinedby the automatic parameter derivation method by increasing or decreasingits value. Again, the user need not fully appreciate how the parametervalue the user is adjusting is used by the automatic parameterderivation method; the sliders or other features used to allow “finetuning” of the values for the detection tool operating parameters willhave labels that relate more closely to the visually discerniblefeatures of the signal sample encompassing the region(s) of interestthan to how the parameters are actually defined for a particularinstance of a detection tool (e.g., “detect more” of this or “detectless” of this versus “increase the value of the short term window”parameter or “decrease the value of the short term window parameter”).

Whenever a user uses an optional sensitivity (e.g., latency) adjustment,systems and methods according to embodiments may be configured toimmediately update a simulation of what the line length detector withthe adjusted threshold parameter is likely to detect, for example, asimulation overlaid on an ECOG the user used to select the start of aregion of interest.

It should be appreciated that in some embodiments, values for additionalor different parameters may be automatically derived based on auser-selected region of interest, depending on the type of activityevident in the region(s) of interest and the particular detection toolfor which the values are being determined. For example, different typesof activity may suggest different types of detectors. Alternatively, andas is the case above with respect to rhythmic activity and spiking,parameters for a single type of detector (e.g., a half wave detector)may be derived in a different order or to have different values for onetype of activity than for another. Examples of detection tools includebut are not limited to: different varieties of half wave detectors andother detectors that operate in the time domain; detectors that operatein the frequency domain, power change detectors other than line lengthdetectors (for example, an area detector); and detectors that are basedin whole or in part on a condition of an active implanted medicaldevice, e.g., on a device diagnostic such as the number of times anamplifier processing the physiological data saturates, etc.).

In a simple case, the examples described above use a single region ofinterest selected by a user, such as the region of interest 520described with reference to FIG. 5. Referring again to FIG. 8, and inparticular, at block 806, more complex examples of a method forautomatically deriving parameter values for a detector may involve auser selecting more than one region of interest. As mentioned above,when a user selects more than one region of interest, a system andmethod according to embodiments may involve one or more preliminarycalculations to determine how to treat the plurality of regions ofinterest.

For example, if a user selects two regions of interest and the regionsof interest are quite different, then a system and method according toembodiments may automatically configure the same type of detector withdifferent parameters for each region of interest (i.e., use twoinstances of the same half wave detector for each region of interest,and automatically derive a set of values for the parameters for thefirst instance of the half wave detector, and automatically derive adifferent set of vales for the parameters of the second instance of thehalf wave detector). The methods by which values for the parameters ofthe two instances of the half wave detector are derived may vary basedon the nature and type of activity in each user-selected region ofinterest.

Alternatively, in the case where a user selects two dissimilar regionsof interest, the system and method may ask the user to make a choice asto, for example (1) whether the two regions of interest the userselected should each be assigned its own instance of a half wavedetector; (2) whether the regions of interest should be combined; or (3)whether one region of interest should be assigned one type of detectorand the other region of interest a different type of detector (e.g., oneregion of interest may be assigned a first half wave detector and thesecond region of interest may be assigned a second half wave detector(where the first half wave detector and second half wave detector havedifferent parameters or use a given parameter or its value in differentways), or one region of interest may be assigned a half wave detectorand the other may be assigned a different detector (such as a linelength detector or an area detector).

On the other hand, if a user selects two regions of interest and theregions of interest are quite similar, then a system and methodaccording to embodiments may undertake one or more preliminarycomputations to combine the two regions of interest before automaticallyderiving the parameter values for a half wave detector. Additionally oralternatively, the system and method may prompt a user to choose whetherthe user wants to detect activity similar to that which is representedin each of the two regions of interest with one instance of a half wavedetector or with two instances of the half wave detector.

When a user selects more than one region of interest at block 802 inFIG. 8, the function of a system and method according to embodimentsthat includes determining whether the regions of interest should becombined for a single instance of a detector (or for a single type ofdetector) is represented at block 806. The function of a system andmethod that includes prompting the user to provide input regarding thenumber of instances of a single type of detector (e.g., half wavedetector) or whether different detectors (e.g., half wave detector, linelength detector) ought to be used, is represented at block 812. If morethan two regions of interests were selected, and the user specified thatmore than one detector type should be generated, the regions may stillneed to be further grouped into detector type. For example if threeregions of interest were selected, the first and second regions ofinterest may be combined to support one detector and the third region ofinterest may support a second detector. The function of the system thatgroups or combines regions of interest is represented at block 822.

An example of a case in which a user may select two dissimilar regionsof interest is illustrated with reference to FIGS. 15A-15D in anapplication where the detector(s) are being used to detect an onset ofseizure activity in a patient. FIG. 15A is a time-series representationof an electrographic signal and FIG. 15B is a spectrogram of the signalof FIG. 15A. The x-axis of each graph corresponds to time in seconds.The y-axis of FIG. 15A is in amplitude units. The signal representsseizure activity 1504. There is an “onset” 1510 characterized by highlyrhythmic activity (see also the banding 1550 in the spectrogram of FIG.15B beginning at about t_(onset1) 1506, which is at about 50 seconds).For convenience, this onset period 1510 is referred to here as “OnsetType 1”.

FIG. 15C is a time-series representation of another electrographicsignal for the same patient and FIG. 15C is a spectrogram of thatsignal. The signal represents seizure activity 1560 (right-most sectionof FIG. 15C). There is an onset period 1574 beginning at about timet_(onset2) 1570, which is at about 45 seconds, but this onset (referredto as “Onset Type 2”) is not characterized by highly rhythmic activity.In this circumstance, because the user has selected two dissimilarregions of interest, it may be more appropriate to use two differentdetector types for these regions, such as a half wave detector for OnsetType 1 and a line length detector for Onset Type 2. Alternatively, afirst half wave detector with a first set of parameters might beappropriate for detecting Onset Type 1 whenever it occurs in thepatient, and a second half wave detector with a different second set ofparameters might be appropriate for detecting Onset Type 2. In stillanother alternative, the same half wave tool might be appropriate fordetecting both Onset Type 1 and Onset Type 2, but the values of theparameters used in the detector considered optimal for detecting OnsetType 1 might be different from the values considered optimal fordetecting Onset Type 2.

An example of a case in which a user may select two similar regions ofinterest is illustrated with reference to FIGS. 16A-16D in anapplication where the detector(s) are being used to detect an onset ofseizure activity in a patient. FIG. 16A is a time-series representationof an electrographic signal and FIG. 16B is a spectrogram of the signalof FIG. 16A. The x-axis of each graph corresponds to time in seconds.The y-axis of FIG. 16A is in amplitude units. The signal representsseizure activity 1604 (right-most section of FIG. 16A). There is an“onset” 1610 characterized by low voltage fast activity discernible atabout a time t_(onset1) 1606 at about 28 s (see also the dark band 1650in the spectrogram of FIG. 16B at around 20 Hz at about t_(onset1)1606). This onset period 1610 is “Onset Type 1” for FIGS. 16A-B.

FIG. 16C is a time-series representation of another electrographicsignal from the same patient and FIG. 16C is a spectrogram of thatsignal. The signal represents seizure activity 1660 (right-most sectionof FIG. 16C). There is an onset period 1674 beginning at about timet_(onset2) 1670, which is at about 28 seconds, and this Onset Type 2 inFIGS. 16C-16D is similar to that of Onset Type 1 in FIGS. 16A-16B. Inthis circumstance, because the user has selected two similar regions ofinterest, it may be appropriate to associate one detector for theseregions, such as a half wave detector. Moreover, where two or moreregions of interest that are similar are selected by a user, the regionsof interest may improve the robustness and accuracy of the system andmethod. For example, by providing more information about the type ofactivity the user would like to detect, a system and method forautomatically deriving parameter values for the half wave detector maybe better at identifying optimal parameter values for the patient.

FIGS. 17A-17C are graphical representations of the frequency response(power spectra) for each of two different regions of interest and for acombination of the two regions of interest. In each of the graphs ofFIGS. 17A-17C, the x-axis represents frequency in Hz and the y-axisrepresents power. At times, it can be useful to combine in a preliminarycomputation or computations information from more than one user-selectedregion of interest so that the system and method of automaticallyderiving a parameter set for a half wave detector can better focus afeature of an electrographic signal which the user is interested indetecting.

For example, in FIGS. 16A-16B, Onset Type 1 corresponds to low voltagefast activity from about 29.3 s to 32.3 s and Onset Type 2 correspondsto low voltage fast activity from about 28.4 s to 31.4 s. Referring toFIG. 17A which corresponds to a first region of interest selected by theuser containing Onset Type 1 activity of the type shown in FIGS.16A-16B, a first peak frequency (or the frequency with the greatestpower) is at around 5 Hz (first peak frequency for Onset Type 1 1710).The next peak frequency in FIG. 17A occurs at around 20 Hz (second peakfrequency for Onset Type 1 1720). Referring to FIG. 17B whichcorresponds to a second region of interest selected by the usercontaining Onset Type 2 activity of the type shown in FIGS. 16C-16D, afirst peak frequency is at around 9 Hz (first peak frequency for OnsetType 2 1750), and a second peak frequency occurs at about 20 Hz (secondpeak frequency for Onset Type 2 1760). When the regions of interest forOnset Type 1 and Onset Type 2 are combined in this example, the graphshowing the frequency response is shown in FIG. 17C. It can beappreciated that a first peak frequency occurs at about 5 Hz (first peakfrequency for combination of Onset Type 1 and Onset Type 2 1770) and asecond peak frequency occurs at about 20 Hz (second peak frequency forcombination of Onset Type 1 and Onset Type 2 1780). A computation (orcomputations) that combines user-selected regions of interestpreliminary to automatically deriving values for the parameters of adetector, such as a half wave detector, thus may be useful inidentifying one or more common features of a set of regions of interest.In this case, the common feature might be a salient frequency 1080 at 20Hz because this is a peak frequency that is present in the combinationof both of the two regions of interest selected by the user (and also ispresent in each of the individual regions of interest).

As described above, parameter sets of detection tools are derived basedon characteristics of signals in ROIs. In summary, systems and methodsdisclosed herein analyze signals within ROIs to detect rhythmic activityor spiked activity or indeterminate activity. Depending on what type ofactivity is detected, the systems and methods automatically determinethe type of detection tool (e.g., half-wave detector) to be used todetect for activity like the activity in the ROI. For example, ifrhythmic activity is detected in the ROI, then a detection tool isprogrammed with a parameter set that enables detection of rhythmicactivity. This detection tool may be referred to as a “rhythmicdetection tool” or a “rhythmic detector.” Likewise, if spike activity isdetected in the ROI, then a detection tool is programmed with aparameter set that enables detection of spike activity. This detectiontool may be referred to as a “spike detection tool” or a “spikedetector.”

Systems and methods disclosed herein enhance the above-describeddetection tool selection and parameter set programming features. Withreference to FIG. 25, a system configured in accordance with suchenhancements selects an ROI at step 2510. The system allows for theselection of two types or modalities of ROIs through a user interface.These modalities include an ROI with a prefixed duration (ROI_(F)) andan ROI with a user-defined duration (ROI_(U)). Typically, seizure onsetis represented by an identifiable electrographic pattern, e.g., rhythmicor spiked. Most of these patterns are brief and last a few seconds. Inthis case, a fixed ROI_(F) modality may be preferred. A seizure,however, can be as long as tens or hundreds of seconds and may berepresented by an electrographic pattern that changes over time. Inthese cases, a user-define ROI_(U) may be beneficial.

ROI with Prefixed Duration: ROI_(F)

With reference to FIG. 26, in a prefixed modality, a user selects aROI_(F) in a given electrographic signal 2600 by clicking a mouse on thesignal displayed on an external component such as the programmer or on aweb page of a website. The point of the click defines the start time2610 of the ROI_(F). The start time typically coincides with thebeginning of the seizure or other patterns of interest. In thismodality, the end time 2620 is automatically set to a prefixed timeafter the start time so as to establish a fixed duration 2630 for theROI_(F). In one configuration, the default value for this prefixed timeis 3 seconds. The end time 2620 of the ROI_(F) is given by:

EndTime=StartTime+prefixedTime

Upon selection of a fixed ROI_(F) by the user, the system selects thefixed ROI_(F) as an ROI for processing, as described further below.

ROI with User-Defined Duration: ROI_(U)

With reference to FIG. 27, in a user-defined modality, a user selects anROI_(U) in a given electrographic signal 2700. The user indicates thestart time 2710 and end time 2720 by clicking and dragging a mouse. Assoon as the user clicks and starts dragging the mouse, a box appearswhose right edge can be dragged to the right as far as the ECOG signal2700 goes. The point where the user releases the mouse (stops dragging),indicates the end time 2720 of the ROI_(U). The end of the ROI_(U)usually coincides with the end of the electrographic seizure. In thismodality, the user determines the duration of the ROI_(U).

Upon selection of a user-defined ROI_(U) by the user, the systemperforms further ROI selection by arbitrarily and automaticallydesignating as an ROI for further processing only a portion of theuser-define ROI_(U) between the start time of the user-defined ROI_(U)and a prefixed duration corresponding to the duration of a fixedROI_(F). In one configuration, the system designates a 3 second portionof the ROI_(U) for processing, as described below.

Determining Detector Type

Returning to FIG. 25, at step 2520, once a ROI is selected by thesystem, the system processes the selected ROI to determine a detectortype (e.g., rhythmic, spiked, etc.) and parameters for the detector.Details of step 2520 are described with reference to FIG. 28.

At step 2810, the system preprocesses the ROI to remove artifacts. TheECOG signal may have flat artifacts due to the brain implantedelectrodes having dual tasks of sensing the ECOG signal and deliveringstimulation. Therefore, during those brief periods (hundreds ofmilliseconds) when the electrodes are not sensing the ECOG signal, thesystem records a flat artifact. Embodiments of the system may processthe ROI to remove these artifacts as follows. First, flat artifacts areidentified in the ROI. Next, segments of the ROI corresponding toidentified flat artifacts are removed. Finally, a linear trend removalfilter is applied to avoid abrupt mean changes in the remaining portionsof the ROI signal.

At step 2820, the system applies a pattern characterization approach todetermine activity type. The pattern characterization approachdetermines if the activity within the selected ROI exhibits clearrhythmic pattern, as shown in FIGS. 20A-20C, or spike patterns, as shownin FIGS. 21A-21C. In some instances, both patterns (rhythmic and spike)may be present either simultaneously or at different times in the ROI(like shown in FIGS. 22A-22C). These instances are categorized as“undetermined” and a second, performance comparison based approach isused to decide which type of detector is most appropriate to detect theactivity present in the selected ROI.

The pattern characterization approach uses a rule-based approach foundedon knowledge and heuristics about rhythmic patterns and spiked patterns.In one configuration, a total of twenty decision-rules may be utilizedto decide activity-type outcome as “rhythmic”, “spike”, or“undetermined”. These rules are based on seven features computed tocharacterize the pattern.

The system computes these seven different features (metrics) based onthe system-selected ROI signal to decide whether rhythmic or spikeactivity is present in the ROI. Some of the features are determined fromthe time domain of the signal, others are determined from the frequencyspectrum of the signal. A description of the seven features follows:

1. Minimum Peak Amplitude (Amp_(L))

With reference to FIG. 29, the minimum peak amplitude feature is basedon the frequency spectrum of the signal, where Amp_(L) is the lowestamplitude peak in the frequency spectrum that meets the followingcriterion:

Amp_(L)>0.05Amp_(H)  (1)

-   -   where    -   Amp_(L) is the minimum peak amplitude that meets the criterion    -   Amp_(H) is the amplitude of the highest peak in the spectrum

In other words, Amp_(L) is the amplitude of the smallest peak in thespectrum that is greater than 5% the amplitude of the highest peak(Amp_(H)) in the spectrum. The amplitude of the highest peak (Amp_(H))is demarcated by the highest vertical dotted line around 10 Hz. Thehorizontal dashed line on FIG. 29 represents the 5% of Amp_(H). Theamplitude of the lowest peak that exceeds the dashed line is Amp_(L). InFIG. 29, Amp_(L) is approximately 4 amplitude units and is illustratedusing the solid vertical line at approximately 28 Hz.

2. Frequency of Peak at Highest Frequency (FPHF)

The FPHF is the highest frequency with a peak spectral amplitude that isgreater than or equal to Amp_(L). In FIG. 29, this frequency is 28 Hz.

3. Quality Factor (Q)

The quality factor (Q) is a dimensionless metric used in engineering tocharacterize a bandpass filter, a resonator, the response of an RLCcircuit, etc. A higher quality factor means a narrower bandwidth (BW)for at the center frequency also know as the resonant frequency. Thequality factor is defined as:

Q=fc/BW  (2)

where:

BW is the bandwidth

fc is the resonant or central frequency

With reference to FIG. 30, the BW is determined as difference of thefrequencies around the peak frequency at which the spectral amplitudehas decreased to half of its value. The dotted vertical lines indicatethe frequencies for which the spectral amplitude has decreased by halfon each side of the highest peak frequency. In the example shown in FIG.30, the BW is given by

BW=f2−f1  (3)

-   -   where BW=11.8 Hz-7.4 Hz=4.4 Hz        Then, for this example Q becomes:    -   Q=10 Hz/4.4 Hz    -   Q=2.3

Accordingly, in this particular application, the peak of highestamplitude is selected and its quality factor is computed as indicatedusing equations (2) and (3).

4. Amplitude Range of Signal in Time Domain (AmpRng)

The AmpRng is based on the time-series, and is defined as the maximumsignal amplitude minus the minimum signal amplitude in the ROI.

5. Low Frequency Energy (LFE)

This feature is based on the frequency spectrum of the signal in the ROIand is computed as the total energy from 3 Hz to 5 Hz. This is the sumof all the frequency spectrum amplitude values between 3 Hz and 5 Hz.

6. Frequency of Highest Peak (FHP)

The FHP is the same as fc defined in the quality factor section. For theexample in FIGS. 29 and 30 it is 10 Hz.

7. Initial Slope in Frequency Spectrum of ROI (IS)

The initial slope of the frequency spectrum is estimated by taking thedifference of the first two consecutive spectral amplitude values in thespectrum.

The final stage of the pattern characterization approach consists ofverifying the twenty rules depicted in FIG. 31A and FIG. 31B. From FIG.31A and FIG. 31B, it is noted that this is a decision tree based on thethresholds applied to the seven features described above. With referenceto FIGS. 28, 31A and 31B, all rectangular boxes of FIG. 31A and FIG. 31Bcorrespond to an output decision for a particular detector type of FIG.28, e.g., a rhythmic detection 2830 or spiked detection 2840, except forthe last output, which is undetermined 2850.

With reference to FIGS. 25 and 28, if the pattern characterizationdetermines either a rhythmic detection 2830 or a spike detection 2840fits the main pattern observed in the selected ROI, the system proceedsto step 2530 of FIG. 25, where the values of the parameters associatedwith each type of detector are determined. If, however, through thewhole decision tree of FIG. 31A and FIG. 31B, the features calculatedfrom the selected ROI do not meet the criteria for any of the differentthreshold-cases, then the system concludes the pattern is undetermined2850. In this case, the system proceeds to step 2860 and applies aperformance characterization approach.

The performance characterization approach utilizes a performancecomparison for all possible detectors, including a rhythmic detector, aspiked detector and a nonlinear energy increase (NEI) detector. Withreference to FIG. 32, the performance comparison is conducted in foursteps. At step 3210, using the selected ROI, the system determines theparameter values for each of the three detectors (e.g., rhythmic,spiked, NEI) using algorithms specific to each detector type. Thesealgorithms are described above with reference to FIG. 8B and FIG. 8C.

At step 3220, the system simulates the detection in the whole ECOGsignal for each detector type using the corresponding parametersdetermined in step 3210. The whole ECOG signal corresponds to the entiresignal from which the selected ROI was selected in step 2510 of FIG. 25.For example, with reference to FIG. 26, the whole ECOG signal 2600 isprocessed using each detector type.

At step 3230, the system calculates metrics on detection outputs of eachof the rhythmic detector, spiked detector and NEI detector. A “detectionoutput” refers to the output of a detector or detection tool with regardto the feature being detected. For example, a half-wave detector isconfigured to detect half-waves. Accordingly, upon detection of ahalf-wave, the half-wave detector outputs a positive detection.

Two metrics are calculated for each of the three detector types based ontheir respective detection outputs. The first metric (ROIdetect)corresponds to true positive detections of the feature being detectedfor (i.e., the feature was actually present in the ROI and the detectordetected it). The first metric is provided as a percentage of positivedetection outputs by the detector of the feature in the selected ROI,with respect to the total number of samples in the selected ROI. Thismetric is determined as follows:

$\begin{matrix}{{ROIdetect} = {{\frac{{total}\mspace{14mu} {number}\mspace{14mu} {of}\mspace{14mu} {samples}\mspace{14mu} {in}\mspace{14mu} {ROI}\mspace{14mu} {where}\mspace{14mu} {detection}\mspace{14mu} {occured}}{{total}\mspace{14mu} {number}\mspace{14mu} {of}{\mspace{11mu} \;}{samples}\mspace{14mu} {in}\mspace{14mu} {ROI}} \cdot 100}\%}} & (4)\end{matrix}$

-   -   wherein the value of the denominator, i.e., total number of ECOG        samples in the ROI, is based on the size of the ROI and the        sampling rate of the processor, and the value of the numerator,        i.e. the total number of samples in the ROI, corresponds to the        number of instances where the algorithm truly detected an        activity (e.g., a half-wave or line length).

Regarding the denominator, as mentioned above, the ROI is defined by thealgorithm based on user input. For example, a user may select the startpoint of a ROI and the algorithm may add three seconds to that startpoint to define a three second ROI. For an algorithm running on aprocessor having a sampling rate of 250 samples per second, the threesecond ROI will include a total of 750 samples. In this case, thedenominator is 750.

The second metric (BSRdetect) corresponds to false positive detectionsof the feature being detected for (i.e., the feature was not present inthe BSR and the detector detected it). The second metric is provided asa percentage of positive detection outputs by the detector of thefeature in the baseline region (BSR) of the signal from which the ROIwas selected, with respect to the total number of samples in the BSR.This metric is determined as follows:

$\begin{matrix}{{BSRdetect} = {{\frac{{total}\mspace{14mu} {number}\mspace{14mu} {of}\mspace{14mu} {samples}\mspace{14mu} {in}\mspace{14mu} {BSR}\mspace{14mu} {where}\mspace{14mu} {detection}\mspace{14mu} {occured}}{{total}\mspace{14mu} {number}\mspace{14mu} {of}{\mspace{11mu} \;}{samples}\mspace{14mu} {in}\mspace{14mu} {BSR}} \cdot 100}\%}} & (5)\end{matrix}$

-   -   wherein the value of the denominator, i.e., total number of ECOG        samples in the BSR, is based on the size of the BSR and the        sampling rate of the processor, and the value of the numerator,        i.e. the total number of sample in the BSR, corresponds to the        number of instances where the algorithm falsely detected an        activity (e.g., a half-wave or line length).

Regarding the denominator, as mentioned above, the BSR is defined by thealgorithm based on user input. For example, a user may select the startpoint of a ROI and the algorithm may define the BSR region as a regionfrom the beginning of the ECOG to an end point that is one second priorto the start point of the ROI. For an algorithm running on a processorhaving a sampling rate of 250 samples per second, the BSR will include atotal number of samples equal to the duration of the BSR×250 samples persecond.

With reference to FIG. 26, the baseline region 2640 is defined as thesignal preceding the ROI, starting at the beginning of the ECOG 2600 andending 1 second prior to the ROI start. In some cases, the BSR may notbe available if the ROI is selected at or close to the beginning of theECOG.

At step 3240, the system compares the two metrics calculated in step3230 across the three detector types, and chooses the highest quality orbest detector type. Ideally, the best detector has an associatedROIdetect of 100% and an associated BSRdetect of 0%. However, inpractice a detector may not obtain such metrics. Therefore, the qualityof a detector may be ascertained in view of both metrics. For example,the closer the ROIdetect metric of detector is to 100%, the better thatdetector type is. Similarly, the closer the BSRdetect metric of adetector is to 0%, the better that detector type is.

With reference to FIG. 33, in one configuration, the system selects thebest detector type based on the following procedure:

At step 3310, the system defines two vectors containing the ROIdetectand BSRdetect metrics. A first vector contains ROIdetect values for eachof the three detector types, while a second vector contains theBSRdetect values for each of the three detector types. The values withineach vector are ordered such that the detector type with the highestROIdetect values is first, followed by the detector type with the secondhighest ROIdetect value, followed by the detector type with the thirdhighest ROIdetect value:

{right arrow over (ROIdetect)}=[ROIdetect(1)ROIdetect(2)ROIdetect(3)]

{right arrow over(BSRdetect)}=[BSRdetect(1)BSRdetect(2)BSRdetect(3)]  (6)

where,

ROIdetect(1) and BSRdetect(1)=metrics from detector type with highestROIdetect;

ROIdetect(2) and BSRdetect(2)=metrics from detector type with secondhighest ROIdetect;

ROIdetect(3) and BSRdetect(3)=metrics from detector type with thirdhighest ROIdetect;

Note detector types 1, 2, and 3 may correspond to one of a “Rhythmic”,“Spike”, or “NEI” detector

The metrics are ranked such as:

ROIdetect(1)>ROIdetect(2)>ROIdetect(3)  (7)

At step 3312, the system determines if a first criterion is met, whereCriterion 1 corresponds to detections in the baseline region. A maximumacceptable threshold is set for the BSRdetect metric where detection inthe BS region should not exceed 5%.

Criterion 1 is considered to be met if any component of the baselinevector BSdetect (defined in Eq. (6)) satisfies the following:

BSdetect(i)<5%  (8)

-   -   where i=1, 2, or 3, corresponding to the three different        detector types

At step 3314, for those detector types 1, 2, and/or 3 that satisfyCriterion 1, the system selects the detector type with highest ROIdetectas a temporarily chosen detector ROIdetectT. At step 3316, thetemporarily chosen detector is evaluated against a second criterion.

Criterion 2 is considered to be met if ROIdetectT satisfies thefollowing

ROIdetectT=ROIdetect(1)  (9)

-   -   where ROIdetect(1) is the highest ranked ROIdetect of the three        detector types, as defined above by Eq. (7).

At step 3318, if Criterion 2 is satisfied, the ROIdetect(1) is selectedas the final chosen detector type. At step 3320, if Criterion 2 is notsatisfied then the system processes ROIdetect(2) or ROIdetect(3) againsta third criterion. As part of this process, the following equalities aredetermined:

ROIdetect(n)−ROIdetect(n−1)<BSRdetect(n)−BSRdetect(n−1),

ROIdetect(n)<5%,

and

BSRdetect(n)−BSRdetect(n−1)<3.5%

-   -   where ROIdetect(n)=ROIdetectT, which may be either one of        ROIdetect(2) or ROIdetect(3)

At step 3322, the system determines if the third criterion is met.Criterion 3 is met if each of the above equations is satisfied. At step3324, if Criterion 3 is met then the system selects ROIdetect(n−1) asthe final chosen detector type. For example, ifROIdetect(n)=ROIdetect(2), and each of the above equalities is met, thenthe final chosen detector type is the detector corresponding toROIdetect(2−1), which is ROIdetect(1). Likewise, ifROIdetect(n)=ROIdetect(3), and each of the above equalities is met, thenthe best detector type is the detector corresponding to ROIdetect(3−1),which is ROIdetect(2).

If any of the above equations are not satisfied, then Criterion 3 isconsidered unmet. In this case, at step 3318, the system selects thedetector corresponding to ROIdetectT as the best detector type. Forexample, if ROIdetect(n)=ROIdetect (2), and at least one of the aboveequalities is unmet, then the best detector type is the detectorcorresponding to ROIdetect(2). Likewise, if ROIdetect(n)=ROIdetect (3),and at least one of the above equalities is unmet, then the bestdetector type is the detector corresponding to ROIdetect(3).

Returning to step 3312, if Criterion 1 is unmet, at step 3326, thesystem selects as a temporary chosen detector, the detector typecorresponding to the lowest ranked BSRdetect in the BSRdetect vectordefined in Eq. (6). In this case, the ROIdetect corresponding to thetemporary chosen detector is evaluated against a fourth criterion.

At step 3328, Criterion 4 is considered to be met if the ROI of thetemporary detector (i.e., ROIdetectT) satisfies the following:

ROIdetectT<50%

If Criterion 4 is unmet, then at step 3330, the system selects thetemporary chosen detector as the best detector type. If Criterion 4 ismet, the system checks if a second temporary chosen detector typecorresponding to the second lowest BSRdetect in the BSRdetect vectordefined in Eq. (6) is better than the temporarily chosen detectorcorresponding to the lowest BSRdetect in the BSRdetect vector. In thiscase, at step 3332, the system defines BSRdetectT2 as the detector withsecond lowest BSRdetect in the BSRdetect vector defined in Eq. (6), andROIdetectT2 as the ROIdetect in the ROIdetect vector defined in Eq. (6)for the same detector. The system evaluates the second chosen temporarydetector against a fifth criterion. As part of this process thefollowing equalities are determined:

BSRdetectT2−BSRdetectT<5%,

and

ROIdetectT2−ROIdetectT>50%

At step 3334, Criterion 5 is considered to be met if each of the aboveequations is satisfied. If Criterion 5 is met, then at step 3336, thesystem selects the detector type corresponding to BSRdetectT2 as thebest detector type. If Criterion 5 is unmet then, then at step 3338, thesystem selects the detector type corresponding to BSRdetectT as the bestdetector type.

Returning to FIG. 25, upon determining a detector type, the systemproceeds to step 2530, where detection parameters are determined. Theseparameters may be determined in accordance with the procedures describedabove, for example, with reference to FIGS. 8A-8C. As part ofdetermining detection parameters, the system may automatically adjustsome of the following parameters.

Rhythmic and Spike Detectors—Automatic Parameter Adjustment

In one embodiment, for the rhythmic and spike detectors, the half-waveminimum amplitude threshold may undergo a final automatic adjustmentbased on detection performance.

Automatic Amplitude Parameter Adjustment

Amp₀ is denoted as the current value proposed for the half-waveamplitude threshold. From the parameter space containing all possibleamplitude values, a subset of potential amplitudes is chosen aroundAmp₀. A typical subset is determined by selecting the twelve consecutiveamplitudes lower than Amp₀, Amp₀, and the twelve consecutive Amplitudeshigher than Amp₀, as shown next:

$\begin{matrix}{{{Amplitudes}\mspace{14mu} {Subset}} = \left\lbrack {{Amp}_{- 12}{Amp}_{- 11}\mspace{14mu} \ldots \mspace{14mu} {Amp}_{- 1}{Amp}_{0}{Amp}_{1}\mspace{14mu} \ldots \mspace{14mu} {Amp}_{11}{Amp}_{12}} \right\rbrack} \\{= \left\lbrack {{{Amp}(1)}{{Amp}(2)}\mspace{14mu} \ldots \mspace{14mu} {{Amp}(12)}{{Amp}(13)}{{Amp}(14)}\mspace{14mu} \ldots \mspace{14mu} {{Amp}(24)}{{Amp}(25)}} \right\rbrack}\end{matrix}$

The parameter set may be limited such that each amplitude parametervalue has a single hysteresis value associated with it. These hysteresisvalues are paired with each amplitude value in a Hysteresis-AmplitudeSubset table:

${{Hysteresis}\text{-}{Amplitudes}\mspace{14mu} {Subset}} = \begin{bmatrix}{{{Hyst}(1)}\mspace{14mu} {{Amp}(1)}} \\{{{Hyst}(2)}\mspace{14mu} {{Amp}(2)}} \\\vdots \\{{{Hyst}(12)}\mspace{14mu} {{Amp}(12)}} \\{{{Hyst}(13)}\mspace{14mu} {{Amp}(13)}} \\{{{Hyst}(14)}\mspace{14mu} {{Amp}(14)}} \\\vdots \\{{{Hyst}(24)}\mspace{14mu} {{Amp}(24)}} \\{{{Hyst}(25)}\mspace{14mu} {{Amp}(25)}}\end{bmatrix}$

Each row of the Hysteresis-Amplitudes Subset table indicates a pair ofvalues in the parameter space. A final automatic adjustment based ondetection performance is conducted to fine tune the half-wave amplitudeparameter. The initial half-wave amplitude determined by the detectiontool (either rhythmic detector or spike detector) is subject to thisfine tuning procedure. Summarizing, the steps of fine tuning thehalf-wave amplitude value include:

1) The detection output for the ECOG is determined using the initialdetection parameters obtained with the detection tool (either a rhythmicdetector or a spike detector).

2) Step 1 is repeated by changing the half-wave amplitude parameter inthe initial detection parameter set. When possible (meaning whenavailable in the parameter space), twelve different consecutive valuesbelow and twelve different consecutive values above the initialhalf-wave amplitude value (Amp₀) are chosen from the parameter space.The detection output for the ECOG is determined using the differentdetection parameter sets formed by using each of these half-waveamplitude values. Note that the only parameter changed across thesedetection parameter sets is the half-wave amplitude parameter and itscorresponding associated hysteresis value.

3) For the detection outputs obtained in steps 1 and 2, two metricscorresponding to Eq. (4) in the ROI region and Eq. (5) in the BSR arecomputed. With reference to FIG. 26, the BSR 2640 is defined as thesignal preceding the ROI, starting at the beginning of the ECOG 2600 andending 3 seconds prior to the start of the ROI 2610. Note that for eachdetection parameter set, there is a unique corresponding detection ratein the ROI defined by Eq. (4) and in the BSR defined by Eq. (5),respectively. Eqs. (4) and (5) are repeated below.

$\begin{matrix}{{ROIdetect} = {{\frac{{total}\mspace{14mu} {number}\mspace{14mu} {of}\mspace{14mu} {samples}\mspace{14mu} {in}\mspace{14mu} {ROI}\mspace{14mu} {where}\mspace{14mu} {detection}\mspace{14mu} {occured}}{{total}\mspace{14mu} {number}\mspace{14mu} {of}{\mspace{11mu} \;}{samples}\mspace{14mu} {in}\mspace{14mu} {ROI}} \cdot 100}\%}} & (4) \\{{BSRdetect} = {{\frac{{total}\mspace{14mu} {number}\mspace{14mu} {of}\mspace{14mu} {samples}\mspace{14mu} {in}\mspace{14mu} {BSR}\mspace{14mu} {where}\mspace{14mu} {detection}\mspace{14mu} {occured}}{{total}\mspace{14mu} {number}\mspace{14mu} {of}{\mspace{11mu} \;}{samples}\mspace{14mu} {in}\mspace{14mu} {BSR}} \cdot 100}\%}} & (5)\end{matrix}$

4) The automatic amplitude parameter adjustment algorithm chooses ahalf-wave amplitude value based on a Criterion 1, where Criterion 1 is[Eq. (5)]<5%, i.e., the detection rate in the BSR is no higher than 5%.Thus, 5% is a maximum acceptable threshold for false positive detectionin the BSR. The algorithm determines which half-wave amplitude valuessatisfy Criterion 1, and then chooses the minimum half-wave amplitudevalue from among those half-wave amplitude values that satisfyCriterion 1. If Criterion 1 is satisfied then the algorithm continues tostep 5.

If none of the half-wave amplitude values satisfies Criterion 1, thenthe algorithm chooses the half-wave amplitude value having the smallestBSR detection rate, i.e., the smallest value for the expression of Eq.(5). The algorithm then continues to step 5.

5) For the half-wave amplitude value chosen in step 4, the algorithmverifies the chosen half-wave amplitude value against a Criterion 2,where Criterion 2 is [Eq. (4)]≧[Eq. (5)], i.e., the ROI detection rateis equal to or greater than the BSR detection rate). If the chosenamplitude value satisfies Criterion 2, the algorithm proceeds to step 6below.

If Criterion 2 is not satisfied by the half-wave value chosen in step 4,then the algorithm determines the minimum half-wave amplitude value forwhich the detection rate in the ROI is higher than the detection rate inthe BSR. Then, the algorithm does a search over the half-wave amplitudevalues until either of the following two criteria is not satisfied. Ateach iteration, the algorithm verifies that:

a. the increase in the detection rate in the BSR for the half-waveamplitude value currently selected compared to the half-wave amplitudevalue immediately smaller is <5%. Note that as the half-wave amplitudevalue decreases the detector becomes more sensitive; and that

b. the variation in detection rate in the BSR for the consecutivehalf-wave amplitude values considered is higher than the variation inthe detection rate in the ROI for the consecutive half-wave amplitudevalues considered. In other words, the increase in the detection rate inROI is less than in the increase in the detection in the BSR.

When either of criteria (a) or (b) is not satisfied, the higher of thetwo half-wave amplitude values used to compute the detection rates inthe ROI and the BSR is chosen as the final half-wave amplitude value,and the process ends.

6) The algorithm does a search over the half-wave amplitude values untileither of the following two criteria is not satisfied. At eachiteration, the algorithm verifies that:

a. the decrease in the detection rate in the ROI for the half-waveamplitude value currently selected compared to the half-wave amplitudevalue immediately higher is <5%. Note that as the half-wave amplitudevalue increases the detector becomes less sensitive; and that

b. the variation in detection rate in the BSR for the consecutivehalf-wave amplitude values considered is higher than the variation inthe detection rate in the ROI for the consecutive half-wave amplitudevalues considered. In other words, the decrease in the detection rate inROI is lesser than the decrease in the detection in the BSR.

When either of criteria (a) or (b) is not satisfied, the lesser of thetwo half-wave amplitude values used to compute the detection rates inthe ROI and the BSR is chosen as the final half-wave amplitude value,and the process ends.

The main goal when selecting the half-wave minimum amplitude thresholdis to chose one that minimizes detection in the baseline region whilemaximizing detection in the ROI. To accomplish this goal, a method basedon performance knowledge and heuristics is followed.

FIG. 34 shows an example of the values obtained for ROIDetect (4) andBSRDetect (5) with each hysteresis-amplitude in a hysteresis-amplitudessubset table. Note that lower indices in the x-axis of FIG. 34correspond to lower half-wave amplitude threshold values in the subsetof parameters chosen. Thus, the maximum index, in this case 25,corresponds to the maximum amplitude value in the subset of theparameter space. As expected, the percentage of detection in eitherregion (ROI or Baseline) decreases as the half-wave amplitude thresholdincreases.

Generic Non-Specific Detector—Automatic Parameter Adjustment

Two key parameters in the NEI detector undergo automatic parameteradjustment: the line length threshold and the window length. Th₀ and W₀are denoted as the initial values proposed for the line length thresholdand the window duration parameters, respectively.

Line Length Threshold Selection Criterion

From the parameter space containing all possible line length thresholdvalues, a subset of potential thresholds is chosen around Th₀. A typicalsubset is determined by selecting the three consecutive thresholdshigher than Th₀ and the three consecutive thresholds lower than Th₀, asshown next:

Threshold Subset=[Th ₃ Th ₂ Th ₁ Th ₀ Th ⁻¹ Th ⁻² Th ⁻³]  (10)

Using the other parameters already determined by the NEI detectionalgorithm parameters (other than the line-length threshold) as describedabove, a detection simulation is conducted for each line lengththreshold value in the subset of potential thresholds defined in Eq.(10). For each detection-simulation the two metrics DetecROI(i) andDetectBSR(i) defined in Eqs. (4) and (5) are computed. With reference toFIG. 26, the baseline region is defined as the sample points in the ECOGpreceding the ROI. There could be a gap between these regions or the gapcould be set to zero (meaning no gap).

The main goal when adjusting the line length threshold is to choose onethat minimizes detection in baseline while maximizing detection in theROI. To determine which threshold value from the subset of consecutivethresholds yields the best performance, the ratio of DetectROI toDetectBSR is computed for each threshold as follows:

$\begin{matrix}{{{ratio}(i)} = \frac{{DetectROI}(i)}{\left( {{{DetectBSR}(i)} + \frac{1}{TotalBSRSamples}} \right)}} & (11)\end{matrix}$

-   -   where i is a discrete value that varies from 1 to N, where N is        the total number of threshold values in the subset (typically        seven).

The line length threshold that produces the highest ratio is chosen asthe new line length threshold. Note that the addition of1/TotalBSRSamples in the denominator of ratio(i) is to prevent adivision by zero in those cases when DetectBSR=0%.

Automatic Window Length/Duration Parameter Adjustment

From the parameter space of window durations for the line lengthdetection algorithm, a subset of values is chosen with two window sizes:1 second and 2 seconds.

Windows Subset=[W ₀ W ₁]  (12)

-   -   where        -   W₀=1 second        -   W₁=2 second

The procedure described above to determine the adjusted line lengththreshold is repeated twice for each of the two window durations in thesubset W₀ and W₁. Tadj₀ and Tadj₁ are denoted the threshold valuesadjusted with windows W₀ and W₁, respectively. Using W₀ and W₁ alongwith their respective adjusted thresholds Tadj₀ and Tadj₁, ratio(W₀) andratio(W₁) are calculated using Eq. (11). The window length that producesthe higher ratio value is chosen.

Generally, the adjusted threshold corresponding to the chosen window isalso chosen, however, there could be a few instances where this is notthe case. The line length detection algorithm becomes more sensitive todetection for smaller windows. Therefore, the following inequalityshould hold:

Tadj ₀ >Tadj ₁  (13)

If the chosen window is W₀ and Eq. (13) is not true, then the algorithmselects the higher of the adjusted thresholds, which for this case isTadj₁.

Returning to FIG. 25, upon determining the detector type and setting andadjusting the parameters of the determined detector type, the systemproceeds to step 2540 where it assesses the performance of the firstproposed detector against a detection criterion to determine whether thefirst proposed detector is adequate or if a second detector is needed.

In one configuration, the first proposed detector analyzes one or moreregions of the signal within the ROI_(U) (excluding the regioncorresponding to the designated ROI_(F) used to select and program thefirst proposed detector). If at step 2550, the first proposed detectorsatisfies a detection criterion, the process proceeds to step 2560,where the first proposed detector is used as the detector for theneurostimulator. In one configuration, the criterion is defined in termsof a percentage of accurate detection, and in one example is at least70%.

Accordingly, if use of the first proposed detector in the region of theROI_(U) results in at least 70% accurate detections, the first proposeddetector is considered accurate.

If at step 2550, the detection criterion is not met, then the processproceeds to step 2570, where a proposed second detector is established.The second detector is established as follows: First the system analyzesthe detection output of the ROI_(U) to define a second ROI_(F)positioned within the ROI_(U). Next, using this second ROI_(F), a seconddetector is determined automatically by the system as follows:

Using the first proposed detector already established for the firstdesignated ROI_(F), a simulation is conducted and the detection outputat each ECOG sample is analyzed to determine non-detection segmentswithin the ROI_(U) (excluding the initial pre-fixed duration ROI_(F)). Anon-detection segment is defined as the time interval where consecutivedetection outputs indicate no detection has occurred. The second ROI_(F)is placed 1.2 seconds after the start of the earliest non-detectionsegment whose duration is greater than 5-seconds, or equivalently D_(n)satisfies:

D _(n) >d ₀  (14)

where

-   -   D_(n)=nth non-detection segment duration    -   n=discrete integer 1, 2, 3, . . . sequentially pointing to each        non-detection segment found in ROI_(U) (excluding initial        ROI_(F))    -   d₀=5 seconds, or other chosen time length

If there are no non-detection segments satisfying Eq. (14), then thesecond ROI_(F) is positioned at the beginning of the earliestnon-detection segment whose duration is greater than preFixedTime (whichis typically 3 seconds)

D _(n)>preFixedTime  (15)

If there are non-detection segments satisfying Eq. (15), then the secondROI_(F) is placed at the beginning of the longest non-detect segmentgreater than preFixedTime/2 (which is typically 1.5 seconds):

D _(n)>preFixedTime/2  (16)

Lastly, if none of the non-detection segments satisfies Eq. (3), thenthe second ROI_(F) is not created.

Upon selection of the second ROI, the process return to step 2520, wherethe system determines a detector type based on analysis of the secondROI.

From the foregoing, it can be appreciated that the approach of choosingvalues for the parameters relevant to a particular detection tool inpairs and/or in a logical sequence encourages results that are morelikely to be closely matched to the nature and type of activity a userdecides to detect (e.g., by selecting region(s) of interest) than wouldbe systems and methods that rely on assigning values to each relevantparameter randomly or one at a time in a “brute force” approach.

It is anticipated that in some embodiments the system and method forautomatically deriving parameter values for a detection tool would beaccomplished primarily using external components rather than animplantable component with a limited power supply. In these embodiments,multiple iterations of a method could be undertaken with input from auser (e.g., to select the number of instances of a detector, the typesof detectors, and to adjust the sensitivity of a detector (such as witha “pattern duration” or “signal amplitude” slider as described above)without consuming power from the implant). When the user is satisfiedwith the simulation results, the user can save the set of parametervalues derived by the method, locally on an external component and/or ina central database (in the case of the RNS SYSTEM, the detection set maybe saved on the physician-user's programmer and/or in the PatientManagement Database (“PDMS”) which is accessible over a secure website).

In other embodiments, there may be opportunities to implement the systemand method for automatically deriving a set of parameters for adetection tool in part using an implantable component in communicationwith an external component, such as a user interface with a display anduser input capability. In still other embodiments, there may be somecapability for a system and method according to embodiments forautomatically adjusting values initially established by aparameter-set-derivation method based on feedback from the implanteddevice, a user or the patient. For example, the user may identify atarget detection rate and the implanted device may adjust detectionparameters (e.g. increasing or decreasing the minimum half waveamplitude parameter 192 to achieve the target detection rate). A “Systemand Method for Automatically Adjusting Detection Thresholds in aFeedback-Controlled Neurological Event Detector” is described in U.S.Pat. No. 8,131,352 to Greene, issued Mar. 6, 2012. U.S. Pat. No.8,131,352 is hereby incorporated by reference in the entirety.

Various example embodiments are thus described. All statements hereinreciting principles, aspects, and embodiments as well as specificexamples thereof, are intended to encompass both structural andfunctional equivalents thereof. Additionally, it is intended that suchequivalents include both currently known equivalents and equivalentsdeveloped in the future, i.e., any elements developed that perform thesame function, regardless of structure. The scope, therefore, is notintended to be limited to the embodiments shown and described herein butrather is defined by the appended claims.

1. A method of deriving a detection tool implemented in an activeimplantable device implantable in a patient, said method comprising:defining a first region of interest in a portion of a signal;establishing a first proposed detection tool based on the first regionof interest; evaluating performance of the first proposed detection toolagainst a detection criterion; and if the detection criterion is notmet, establishing a second proposed detection tool based on a secondregion of interest, the second region of interest being defined bydetection outputs of the first proposed detection tool.
 2. The method ofclaim 1, wherein establishing a first proposed detection tool comprises:selecting a detection tool type by processing the first region ofinterest to recognize a pattern corresponding to one of a rhythmicpattern, a spiked pattern or an undetermined pattern; and determiningparameter values for the selected detection tool type.
 3. The method ofclaim 2, wherein processing comprises: computing a plurality of metricsfor the first region of interest; and applying one or more of theplurality of metrics to one or more of a plurality of rules, each rulehaving a positive outcome resulting in a recognized pattern and anegative outcome resulting in an advancement to a next rule.
 4. Themethod of claim 2, wherein, if the recognized outcome is undetermined,then further comprising: processing the first region of interest toestablish each of a rhythmic detection tool, a spiked detection tool,and a nonlinear energy increase detection tool; for each of thedetection tools: processing the signal using the detection tool toobtain detection outputs; and calculating a plurality of detectionmetrics based on the obtained detection outputs; and processing theplurality of detection metrics for each of the detection tools to selecta best detection tool type from among the rhythmic detection tool, thespiked detection tool, and the nonlinear energy increase detection tool.5. The method of claim 2, wherein, in the case of a selected detectiontool type having a half-wave amplitude threshold parameter, determiningparameter values for the selected detection tool type comprises:establishing a plurality of potential half-wave amplitudes, each havingan associated hysteresis value, each potential half-wave amplitude andits associated hysteresis value defining a hysteresis-amplitude pair;for each hysteresis-amplitude pair: applying the hysteresis-amplitudepair to the detection tool; processing the signal using the detectiontool to obtain detection outputs; and calculating a plurality ofdetection metrics based on the obtained detection outputs; processingthe detection metrics for each hysteresis-amplitude pair to identify thebest hysteresis-amplitude pair; and setting the half-wave amplitudethreshold parameter to the potential half-wave amplitude of theidentified best hysteresis-amplitude pair.
 6. The method of claim 5,wherein: the plurality of metrics comprises a region-of-interest metricbased on the number of detections in the region of interest, and abaseline metric based on the number of detections in a baseline region,and the hysteresis-amplitude pair that minimizes detections in thebaseline while maximizing detections in the region of interest isidentified as the best hysteresis-amplitude pair.
 7. The method of claim2, wherein, in the case of a selected detection tool type having aline-length threshold parameter, determining parameter values for theselected detection tool type comprises: establishing a plurality ofpotential line-length threshold; for each line-length threshold:applying the line-length threshold to the detection tool; processing thesignal using the detection tool to obtain detection outputs; andcalculating a plurality of detection metrics based on the obtaineddetection outputs; processing the detection metrics for each line-lengththreshold to identify the best line-length threshold; and setting theline-length threshold parameter to the identified best line-lengththreshold.
 8. The method of claim 7, wherein: the plurality of metricscomprises a region-of-interest metric based on the number of detectionsin the region of interest, and a baseline metric based on the number ofdetections in a baseline region, and the line-length threshold resultingin a highest ratio is identified as the best line-length threshold,wherein the ratio is a ratio of the region-of-interest metric and thebaseline metric.
 9. The method of claim 2, wherein, in the case of aselected detection tool type having a window length parameter,determining parameter values for the selected detection tool typecomprises: establishing a plurality of potential window lengths; foreach window length: applying the window length to the detection tool;processing the signal using the detection tool to obtain detectionoutputs; and calculating a plurality of detection metrics based on theobtained detection outputs; processing the detection metrics for eachwindow length to identify the best window length; and setting the windowlength parameter to the identified best window length.
 10. The method ofclaim 9, wherein: the plurality of metrics comprises aregion-of-interest metric based on the number of detections in theregion of interest, and a baseline metric based on the number ofdetections in a baseline region, and the window length resulting in ahighest ratio is identified as the best window length, wherein the ratiois a ratio of the region-of-interest metric and the baseline metric. 11.The method of claim 1, wherein evaluating performance of the firstproposed detection tool against a detection criterion comprises:processing one or more regions of the signal using the first proposeddetection tool, the one or more regions excluding the region ofinterest; determining a metric of detection accuracy; and comparing themetric to the detection criterion.
 12. The method of claim 1, whereinestablishing a second proposed detection tool based on a second regionof interest comprises: processing one or more regions of the signalusing the first proposed detection tool, the one or more regionsexcluding the first region of interest; determining one or morenon-detection segments, each non-detection segment corresponding to atime interval between consecutive detection outputs of the firstproposed detection tool; and processing the one or more non-detectionsegments to identify a start of the second region of interest.
 13. Anapparatus for deriving a detection tool implemented in an activeimplantable device implantable in a patient, said apparatus comprising:a memory; and a processor coupled to the memory and configured to:define a first region of interest in a portion of a signal; establish afirst proposed detection tool based on the first region of interest;evaluate performance of the first proposed detection tool against adetection criterion; and if the detection criterion is not met,establish a second proposed detection tool based on a second region ofinterest, the second region of interest being defined by detectionoutputs of the first proposed detection tool.
 14. The apparatus of claim13, wherein to establish a first proposed detection tool, the processoris configured to: select a detection tool type by processing the firstregion of interest to recognize a pattern corresponding to one of arhythmic pattern, a spiked pattern or an undetermined pattern; anddetermine parameter values for the selected detection tool type.
 15. Theapparatus of claim 14, wherein to process the first region, theprocessor is configured to: compute a plurality of metrics for the firstregion of interest; and apply one or more of the plurality of metrics toone or more of a plurality of rules, each rule having a positive outcomeresulting in a recognized pattern and a negative outcome resulting in anadvancement to a next rule.
 16. The apparatus of claim 14, wherein, ifthe recognized outcome is undetermined, the processor is furtherconfigured to: process the first region of interest to establish each ofa rhythmic detection tool, a spiked detection tool, and a nonlinearenergy increase detection tool; for each of the detection tools: processthe signal using the detection tool to obtain detection outputs; andcalculate a plurality of detection metrics based on the obtaineddetection outputs; and processing the plurality of detection metrics foreach of the detection tools to select a best detection tool type fromamong the rhythmic detection tool, the spiked detection tool, and thenonlinear energy increase detection tool.
 17. The apparatus of claim 14,wherein, in the case of a selected detection tool type having ahalf-wave amplitude threshold parameter, the processor determinesparameter values for the selected detection tool type by being furtherconfigured to: establish a plurality of potential half-wave amplitudes,each having an associated hysteresis value, each potential half-waveamplitude and its associated hysteresis value defining ahysteresis-amplitude pair; for each hysteresis-amplitude pair: apply thehysteresis-amplitude pair to the detection tool; process the signalusing the detection tool to obtain detection outputs; and calculate aplurality of detection metrics based on the obtained detection outputs;process the detection metrics for each hysteresis-amplitude pair toidentify the best hysteresis-amplitude pair; and set the half-waveamplitude threshold parameter to the potential half-wave amplitude ofthe identified best hysteresis-amplitude pair.
 18. The apparatus ofclaim 14, wherein, in the case of a selected detection tool type havinga line-length threshold parameter, the processor determines parametervalues for the selected detection tool type by being further configuredto: establish a plurality of potential line-length threshold; for eachline-length threshold: apply the line-length threshold to the detectiontool; process the signal using the detection tool to obtain detectionoutputs; and calculate a plurality of detection metrics based on theobtained detection outputs; process the detection metrics for eachline-length threshold to identify the best line-length threshold; andset the line-length threshold parameter to the identified bestline-length threshold.
 19. The apparatus of claim 14, wherein, in thecase of a selected detection tool type having a window length parameter,the processor determines parameter values for the selected detectiontool type by being further configured to: establish a plurality ofpotential window lengths; for each window length: apply the windowlength to the detection tool; process the signal using the detectiontool to obtain detection outputs; and calculate a plurality of detectionmetrics based on the obtained detection outputs; process the detectionmetrics for each window length to identify the best window length; andset the window length parameter to the identified best window length.20. The apparatus of claim 13, wherein the processor evaluatesperformance of the first proposed detection tool against a detectioncriterion by being configured to: process one or more regions of thesignal using the first proposed detection tool, the one or more regionsexcluding the region of interest; determine a metric of detectionaccuracy; and compare the metric to the detection criterion.
 21. Theapparatus of claim 13, wherein the processor establishes a secondproposed detection tool based on a second region of interest by beingconfigured to: process one or more regions of the signal using the firstproposed detection tool, the one or more regions excluding the firstregion of interest; determine one or more non-detection segments, eachnon-detection segment corresponding to a time interval betweenconsecutive detection outputs of the first proposed detection tool; andprocess the one or more non-detection segments to identify a start ofthe second region of interest.
 22. A method of deriving a detection toolimplemented in an active implantable device implantable in a patient,said method comprising: defining a first region of interest in a portionof a signal; computing a plurality of metrics for the first region ofinterest; and recognizing a pattern corresponding to one of a rhythmicpattern, a spiked pattern or an undetermined pattern by applying one ormore of the plurality of metrics to one or more of a plurality of rules,each rule having a positive outcome resulting in a recognized patternand a negative outcome resulting in an advancement to a next rule. 23.An apparatus for deriving a detection tool implemented in an activeimplantable device implantable in a patient, said apparatus comprising:a memory; and a processor coupled to the memory and configured to:define a first region of interest in a portion of a signal; compute aplurality of metrics for the first region of interest; and recognize apattern corresponding to one of a rhythmic pattern, a spiked pattern oran undetermined pattern by applying one or more of the plurality ofmetrics to one or more of a plurality of rules, each rule having apositive outcome resulting in a recognized pattern and a negativeoutcome resulting in an advancement to a next rule.